memory leak in free()

John Baldwin jhb at freebsd.org
Wed Jun 14 14:25:58 UTC 2006


On Wednesday 14 June 2006 04:07, Krassimir Slavchev wrote:
> Hello,
> 
> This simple code demonstrates the problem:
> 
> int main ()
> {
>     char* buffer1;
>     char* buffer2;
>     int size = 2*1024*1024 + 1;
> 
> for(;;) {
>         buffer1 = (char *) malloc(size);
>         buffer2 = (char *) malloc(size);
> 
>         free(buffer1);
>         free(buffer2);
>  }
> }
> 
> The second free() does not free allocated memory if size >2Mb.
> 
> On 6.1-STABLE all is OK.

This is probably an issue with jemalloc, I've cc'd jasone@ who wrote the
new malloc() in HEAD.

-- 
John Baldwin <jhb at FreeBSD.org>  <><  http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve"  =  http://www.FreeBSD.org


More information about the freebsd-current mailing list