Message-Id: <199707221544.RAA10017@hera.hu.bonus.com> From: "Gyorgy Abonyi" To: Subject: Re: mem alloc taking up power of 2 Date: Tue, 22 Jul 1997 17:44:05 +0200 MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Precedence: bulk Esa Peuha wrote: > Shawn Hargreaves wrote: > > When you say that you are losing > > 640k, remember that this is virtual memory, so if you never touch the > > space the DPMI server won't actually bother to allocate any hardware > > pages for it. > True, but it must still allocate enough _disk space_ for it. The DPMI > host can't know that you'll never touch that memory, and it must be able > to page it in physical RAM if you do. The DPMI allocate the hardware and/or disk pages when You first reference it. Try to allocate 50 Megs on a system with only 16Mbytes ram. You will see, that the DPMI server won't create any swap file, while You won't reference it. In Your example (as I remember) You tried to allocate 34K, and DJGPP allocated 64K... Since in normal cases You never reference the extra 30K, the DPMI server doesn't create hardware or disk pages of it. You will loose only some megs of your linear address space, but since it's usualy 2 Gbytes length (at least with CWSDPMI), it doesn;t count to much I think... The only memory space You can lost is the last page fragment. BTW this behaivor of DJGPP comes from the malloc routine it uses. It's fast, but can wastes parts of Your linear address space. Check out the malloc function in the runtime library source. > > The only thing being wasted is a few meg of your 32 bit > > linear address space, but there's plenty of that to go around :-) > Disk space (in the swap file) is also being wasted, and this may be a > problem. See previous remmark. Gyorgy Abonyi jr. loop AT hu DOT bonus DOT com