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 <[EMAIL PROTECTED]>, 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
> [EMAIL PROTECTED]         | 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 [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message

Reply via email to