Date: Wed, 24 Jun 1998 11:38:05 +0300 (IDT) From: Eli Zaretskii To: "Salvador Eduardo Tropea (SET)" cc: djgpp-workers AT delorie DOT com Subject: Re: DJGPP v2.01 malloc wasting 4Kb In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Precedence: bulk On Tue, 23 Jun 1998, Salvador Eduardo Tropea (SET) wrote: > If I'm right malloc is wasting 4Kb each time we allocate a block >= 4Kb. > Malloc allocates one extra page and this page is simply wasted. I > saw it when I tried to allocate all the RAM in pages Can you post a simple test program to demonstrate this? IIRC, this has come up previously, and the conclusion was that if you are careful in your calls to malloc (e.g., request 4KB minus 8 bytes of overhead, etc.), there's no waste. > 1) Is that correct? (To test it you can make some allocations of > 4000 bytes and check the free memory you'll see each allocation is > taking 2 pages instead of 1). I think the slack space is sometimes used by malloc for smaller allocations (which of course doesn't help if you need all your chunks be 4KB). So this isn't the complete test, you need to try smaller allocations after each 4KB and see if available memory changes. Also, if you need whole pages of memory, why don't you use sbrk instead of malloc? > 2) Can we fix it in the distribution? Given that v2.02 tosses BSD malloc and replaces it with an entirely different version, why should we bother to replace malloc in v2.01? > Currently there are too much known bugs in v2.01, as an example: my > editor needs at least 3 patchs for libs to work. There's the patched libc site for this. If you have a version of malloc which is tested enough to be used by others, submit the patches to Nate. > 3) What's the status of 2.02? The last snapshot is too old! We don't always have control on how much free time we can spend on DJGPP. Maybe if more volunteers would help (hint, hint), it will move faster. > I know Nate is mainting an unofficial patched version but: Are these patchs > really tested? Most of them are mine. Those which are mine were used to build the binary distributions of all the packages I uploaded for the last year at least, and I use all those packages every day. So I'd say they are tested quite well, but only in the environments that I use (which include plain DOS (versions 5 and 6.2) and Windows 95 4.00.950r7, approximately 50%-50%. > isn't that worst than having an updated beta version? IMHO, v2.02 isn't ready for beta yet. See my other mail.