Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!zaphod.mps.ohio-state.edu!wuarchive!uunet!news.uu.net!microsoft!donc From: donc@microsoft.UUCP (Don CORBITT) Newsgroups: comp.windows.ms.programmer Subject: Re: Allocating a lot of memory (why can't I?) Message-ID: <72462@microsoft.UUCP> Date: 20 May 91 21:24:17 GMT References: <518@pcad.UUCP> <72271@microsoft.UUCP> <522@pcad.UUCP> Reply-To: donc@microsoft.UUCP (Don CORBITT) Organization: Microsoft Corp., Redmond WA Lines: 24 In article <522@pcad.UUCP> rob@pcad.UUCP (Ralph Brown) writes: >In article <72271@microsoft.UUCP>, donc@microsoft.UUCP (Don CORBITT) writes: [I (donc) make suggestions] >> I'm able to routinely allocate 4 MB (and sometimes 8MB) on my system with >> 8MB ram, (6MB available to Windows). You should be able to, also. [He (Ralph) supplies details, which include oscillation 1.x MB to 3.x MB]> >Do you have a large swap file? You said that occasionally you can get 8MB, >normally 4 MB. What distinguishes these two cases? > >Ralph This was a fun question, so I looked into it further. PageLocked (uncommon) and Fixed (too common!) objects fragment the protect-mode heap. If you had ToolHelp.DLL, you could scan the heap in your program, and find which if any memory blocks are fixed or pagelocked. This would let us know if there was a believable explanation for this behaviour. Answering your question, I ran a quick, 10 line program (output was a MessageBox() :-), so I don't know why I got 4MB some times, and 8MB others. However, the granularity was 2X each request, so it may be that 7.999MB was available when I say I only got 4MB. -- Don Corbitt, uunet!microsoft!donc. Windows Developer. Mail flames, post apologies.