Date: Sun, 2 Jun 1996 09:46:54 +0200 (IST) From: Eli Zaretskii To: "Vyacheslav O. Myskin" Cc: djgpp AT delorie DOT com Subject: Re: How much free memory? In-Reply-To: <4ojf0s$o2q@sky.inp.nsk.su> Message-Id: Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII On Thu, 30 May 1996, Vyacheslav O. Myskin wrote: > I'd like to know the answer too. I've browsed the list of > memory-related functions and found nothing to get the amount of memory > available. What's wrong with `__dpmi_get_free_memory_information' and `__dpmi_get_memory_information'? > And here are some results of my experiments with malloc: [snip] > Malloc seems to grab about 30% of memory for its needs! Is there any > way to tune it? If I want to allocate all my free memory as one big > block, perhaps I don't need several Mb to store information about it. Please read Chapter 15 of the DJGPP FAQ list. It explains how different DPMI servers affect the largest memory chunk you can allocate. If after that you still can't explain the behavior that you see, tell more about your system. In particular, under Windows, the behavior depends on the various memory-related settings of the PIF file (Win3.x) or the Property Sheet (Win95) for the DOS box, as explained by the FAQ. You should also know that DJGPP `malloc' rounds the size to a nearest power of 2, which might explain some failures. But most DPMI servers won't allow you to allocate more than half of available memory in a single chunk anyway, so that `malloc' misfeature is usually not too important.