Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!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: <72271@microsoft.UUCP> Date: 10 May 91 19:20:03 GMT References: <518@pcad.UUCP> Reply-To: donc@microsoft.UUCP (Don CORBITT) Organization: Microsoft Corp., Redmond WA Lines: 21 >rob@pcad.UUCP (Ralph Brown) writes: >> Running Win 3.0 in enhanced mode, there seems to be some limit to how >> much memory a windows app can allocate which is much less than the >> amount of free virtual memory. With over 7Mb free, I could only do >> a Global32Alloc of about 1.3 Mb. A second copy of the same program could >> simultaneously get about the same amount leaving about 5Mb still free. I'm not sure what's happening on your systems. It is possible your heap is filled with pagelocked objects, but real unlikely. Are you calling GlobalAlloc(), or are you calling GlobalCompact(0)? Note that under Enchanted mode, GlobalCompact() doesn't really compact the heap, it just tells you the largest block you can get _without_ compacting. This is on purpose, since compacting the heap on a page-swapping system takes a lot of time and disk access. If you really want a lot of memory, just allocate it. This will convince Windows that you are serious, and force heap compaction. 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. -- Don Corbitt, MSWinDev