Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!pcad!rob From: rob@pcad.UUCP (Ralph Brown) Newsgroups: comp.windows.ms.programmer Subject: Re: Allocating a lot of memory (why can't I?) Message-ID: <523@pcad.UUCP> Date: 14 May 91 18:57:50 GMT References: <518@pcad.UUCP> <1991May13.003243.26563@maytag.waterloo.edu> Organization: Personal CAD Systems, Westford, MA Lines: 31 In article <1991May13.003243.26563@maytag.waterloo.edu>, cgeisler@maytag.waterloo.edu (Craig Eisler) writes: > Windows 3.0 has some insane restriction on your real-to-virtual ratio > when allocating memory in enhanced mode; on a system with 64MB of virtual > memory, the maximum I have been able to Global32Alloc is about 18MB. > > I have been told by those in the know that this silly restriction will > leave us in Windows 3.1, but for now, we're just stuck. Yes, I've heard the same thing, but I think it's more complex than that :-< I wrote a small program that just attempts to allocate the largest block it can get by allocing and freeing larger and larger pieces, or attempts to get a big piece all at once. In a system starting with 7.7MB from GetFreeMem, and nothing else running it got 3.1MB using repeatedly larger blocks. However, if I start the program and just try to get 3 MB in one piece without first doing the incremental size mallocs, it fails, consistantly, in fact, I can't get 2 MB in one shot. I then do the allocation in pieces (same invocation) and I get back to 3.1 MB and then can from then on alloc the full 3.1 in one shot. It seems like the heap needs a bit of conditioning when it starts. I don't see why I can't get a big hunk of the other 4M however. On a related note, if I alloc 3MB and keep it, then attempt to run WindowPaint, I get an insufficient memory error despite having over 4MB and 83% of resources free. This makes me wonder if it is possible to use over about half of virtual memory at all! Ralph