From: Shawn Hargreaves Newsgroups: comp.os.msdos.djgpp Subject: Re: windows <-> cwsdpmi Date: Fri, 20 Dec 1996 19:24:02 +0000 Organization: None Lines: 20 Distribution: world Message-ID: References: <32B8B3EE DOT 7AEC AT cs DOT com> NNTP-Posting-Host: talula.demon.co.uk MIME-Version: 1.0 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Eli Zaretskii writes: >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. I've got an implementation of malloc() and co, which has been sitting around on my hard drive for the last few years (I believe it originated in the libc for the Atari version of gcc). It uses a linked list of free memory blocks, and splits off chunks from this when mallocing memory. The list is sorted, so free() can reinsert the block into the correct part of the list and merge with adjacent free blocks as required. It's probably a bit slower than the existing implementation, but doesn't waste nearly so much memory. If anyone's interested, I can post the code... /* * Shawn Hargreaves - shawn AT talula DOT demon DOT co DOT uk - http://www.talula.demon.co.uk/ * Ghoti: 'gh' as in 'enough', 'o' as in 'women', and 'ti' as in 'nation'. */