Mail Archives: djgpp/1996/12/19/02:13:01
On Wed, 18 Dec 1996, John M. Aldrich wrote:
> The malloc() used by DJGPP rounds the size of allocated memory blocks to
> the next higher power of 2. So, allocating 300 bytes gets you 512;
> allocating 1500 bytes gets you 2048, and allocating 8 MB + 1 gives you
> 16 MB.
Actually, even "malloc (8 * 1024 * 1024)" will ask for 16MB, because
`malloc' needs a few more bytes for its overhead for every allocation
(how else would it know the size of the buffer when you `free' it?). So
you should ask for a bit less than 8MB to get 8MB.
> This, unfortunately, is a speed optimization of the GNU C
> compiler, so it can't easily be changed.
It has nothing to do with the compiler. It's just a (mis)feature of the
`malloc' algorithm in DJGPP library (taken from the BSD libc, if memory
serves). Volunteers are welcome to suggest alternative implementations
of `malloc' & Co., which are free of this problem.
> or set DPMI memory to 64 MB in the Control Panel (win95).
On Windows 95, this is done in the property sheet of the DOS box, not in
the Control Panel.
- Raw text -