RE: [Dev-C++] new is a wrapper around malloc so...
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Per W. <pw...@ia...> - 2003-07-16 12:17:20
|
64-bit isn't just a speed issue :-) Anyway, while most motherboards may only support 2-4GB memory, but the 386 processor isn't limited to 4GB physical memory, and some server motherboards supports a lot more. However, with 32-bit paged memory the machine may then run a number of applications each allocating 2-3GB. But each individual application is limited. There is a way around it. It's the dreaded 48-bit far pointer (16:32) where the processor is supporting up to 65536 memory segments of up to 4GB each. However, all programmers and compiler vendors have already learned to hate the old 16:16 far pointers from 8086 (1MB) and 80286 (16MB) so nobody is rushing for 48-bit pointers. Segmented memory doesn't support or work very well with a number of concepts we have learned to use and love with our current paged memory model: - On-demand allocation. Automatically grow the stack in 4kB increments whenever needed. - Memory fragmentation. In a paged environment, the OS may never get fragmented memory, since each memory page is identical. It just keeps track of a list of available pages, and maps in the first available page when a process needs more memory. With segmented memory, the OS will normally have to block the task and move the memory segments around in the physical memory to get a continuous free block large enough for a memory allocation. /Per W On Wed, 16 Jul 2003, Daniel Glenfield wrote: > Ahhhhhhhhhhh, so that's why everyone wants 64-bits. Games too are requiring > more, probably because of the same memory-mapping issues. > > > >From: Per Westermark <pw...@ia...> > >To: Daniel Glenfield <sp...@ho...> > >CC: mu...@gm..., <dev...@li...> > >Subject: RE: [Dev-C++] new is a wrapper around malloc so... > >Date: Wed, 16 Jul 2003 12:26:07 +0200 (CEST) > > > >A 32-bit pionter is an unsigned entity, so it can span 2^32 bytes - 4GB. > >From this address space, the different OS then reserves areas for OS code, > >buffers, IPC etc. Depending on OS, you may normally not allocate more than > >2 or 3GB for a single application. > > > >This is the big reason why the world is so desperately wanting 64-bit > >machines. In database solutions it is quite common to memory-map the > >database files. However, 2-3GB is a puny database. > > > >/Per W > > > >On Wed, 16 Jul 2003, Daniel Glenfield wrote: > > > > > All I know is that the MSDN documentation I read says 2GB. I'm not sure > > > about how you calculate it all, so you're one up on me! > > > > > > > > > >From: "Abhijit Shylanath" <mu...@gm...> > > > >To: "Daniel Glenfield" <sp...@ho...> > > > >CC: "Dev-Cpp mailing list" <dev...@li...> > > > >Subject: RE: [Dev-C++] new is a wrapper around malloc so... > > > >Date: Wed, 16 Jul 2003 00:40:19 +0530 > > > > > > > > > > > > > In 16 bit your code is separated into 'segments' each a maximum of > >64k > > > >in > > > > > size. 32-bit can have up to 2GB segments (!!!). > > > > > > > >4G, right? (2^32). > > > > > > > >However, that's true only on a 32-bit system (as you've said)... what > > > >platform are you building on? On 16-bit (`real-mode') DOS, even though > > > >sizeof(farptr) will give you four, it cannot address 32-bits worth of > > > >memory. Far pointers work like this: > > > > > > > > 32 bits of farptr = > > > > 16 bits of segment . > > > > 16 bits of offset > > > > > > > >The effective address is actually calculated by multiplying the segment > >by > > > >16 decimal (0x10 (which is equivalent to left-shifting by four)) and > >then > > > >ADDING the offset... so that if your far-ptr has this value: > > > > > > > > 0x1234abcd > > > > > > > >Written as: > > > > > > > > 1234:abcd > > > > > > > >Its effective address, which is worth 20-bits (and can therefore > >address > > > >2^20 = 1M) is calculated as: > > > > > > > > 0x12340 > > > >+ 0xabcd > > > >------------- > > > >= 0x1cf0d > > > > > > > >Whereas, in the flat memory model(protected-mode), the effective > >address > > > >would itself be > > > > > > > > 0x1234abcd > > > > > > > >-- > > > >Abhijit Shylanath > > > >Homepage: http://mudeth.tripod.com/ > > > > > > > > > > _________________________________________________________________ > > > On the move? Get Hotmail on your mobile phone > >http://www.msn.co.uk/msnmobile > > > > > > > > > > > > ------------------------------------------------------- > > > This SF.net email is sponsored by: VM Ware > > > With VMware you can run multiple operating systems on a single machine. > > > WITHOUT REBOOTING! Mix Linux / Windows / Novell virtual machines at the > > > same time. Free trial click here: http://www.vmware.com/wl/offer/345/0 > > > _______________________________________________ > > > Dev-cpp-users mailing list > > > Dev...@li... > > > TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm > > > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > > > > > > > > > > >------------------------------------------------------- > >This SF.net email is sponsored by: VM Ware > >With VMware you can run multiple operating systems on a single machine. > >WITHOUT REBOOTING! Mix Linux / Windows / Novell virtual machines at the > >same time. Free trial click here: http://www.vmware.com/wl/offer/345/0 > >_______________________________________________ > >Dev-cpp-users mailing list > >Dev...@li... > >TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm > >https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > > _________________________________________________________________ > It's fast, it's easy and it's free. Get MSN Messenger today! > http://www.msn.co.uk/messenger > > |