Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 6 Dec 2000 20:07:07 +0100 (CET)
From:      Remy Nonnenmacher <remy@boostworks.com>
To:        phk@critter.freebsd.dk
Cc:        freebsd-hackers@FreeBSD.ORG
Subject:   Re: free() not freing pagedirs pages. 
Message-ID:  <200012061907.UAA31917@luxren2.boostworks.com>
In-Reply-To: <51350.976119810@critter>

next in thread | previous in thread | raw e-mail | index | archive | help
OK. In fact my problem was just a printf that allocated a buffer via
__smakebuf at the very last moment (when all memory was allocated).
This prevent free() to give back all previous pages up to this one. The
problem was _not_ in malloc.c.

Anyway, i learned a lot from hacking the source to catch the caller.
Thanks.

RN.
IhM

On  6 Dec, Poul-Henning Kamp wrote:
> In message <200012061612.RAA30340@luxren2.boostworks.com>, Remy Nonnenmacher wr
> ites:
> 
>>>From the /usr/src/lib/libc/stdlib/malloc.c sources, it seems that this
>>is due to not shrinking/relocating pagedir pages (free_pages(), comment
>>around line 940). This means that returning pages stop at first
>>allocated pagedir.
> 
> That is actually not correct.  the pagedir is allocated with mmap
> from anonymous memory and does not affect the sbrk(2)'ing.
> 
>>It seems to be a problem also in some other Unixes, anyway, but i would
>>like to know if:
> 
> Presuming your question then is "can the pagedir be shrunk ?" the 
> answers are:
> 
>>1) This is historical and must not be fixed.
> 
> no.
> 
>>2) This can be easily fixed.
> 
> maybe.
> 
>>3) Fixing it would lead to enormous problems. Better keep it like this.
> 
> unlikely.
> 
> Have you read the paper in src/share/doc/papers/malloc ?
> 
> Also, if you are truly concerned with the returning to the OS of
> memory, examine the 'H' option to phkmalloc.
> 
> --
> Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
> phk@FreeBSD.ORG         | TCP/IP since RFC 956
> FreeBSD committer       | BSD since 4.3-tahoe    
> Never attribute to malice what can adequately be explained by incompetence.




To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200012061907.UAA31917>