From: gpt20 AT thor DOT cam DOT ac DOT uk (G.P. Tootell) Newsgroups: comp.os.msdos.djgpp Subject: Re: problem with malloc in djgpp? Date: 12 Mar 1997 09:30:35 GMT Organization: University of Cambridge, England Lines: 31 Sender: gpt20 AT hammer DOT thor DOT cam DOT ac DOT uk (G.P. Tootell) Message-ID: <5g5t3r$j30@lyra.csx.cam.ac.uk> References: NNTP-Posting-Host: hammer.thor.cam.ac.uk To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp |> > on startup the program claims (under pure dos) that it has 0.7meg real and 121meg |> > virtual memory available. |> |> What kind of system setup do you use? If you have 8 or 16MB of RAM, how |> come DJGPP only sees 0.7MB free? Did you install a huge disk cache |> and/or RAM disk? nope i didn't do anything. it's someone else's machine :( i think the word is 'a crap system' :) i tested on a 486dx66 and a p90 (the former with 8 meg the latter with 16 meg) but i don't have the option to fiddle with their boot files and get more memory, and besides i couldn't get 14meg out of an 8 meg machine :) |> > now i get 7.1meg real and 120meg virtual available. this should be enough to |> > allocate the 14meg buffer that i require though. |> > dpmi_free_memory, or whatever the hugely long name for it is, says it has |> > 127.1meg total therefore. but malloc returns a null pointer when i try to dim the |> > block. why on earth should this be the case? |> |> That's because the value returned by `_go32_dpmi_remaining_virtual_memory' |> *includes* the free physical memory. When you add the two, you get |> larger amount than what you actually have, so `malloc' fails. erk!! this isn't in the clib references, nor the faq methinks. or is it hiding under some other heading maybe. i was under the impression this was the virtual only and didn't include the physical memory. having said that, i should still have 120meg however, so it doesn't actually explain why the malloc failed ;( regards nik --