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 10:27:21
|
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 > |