Created attachment 10554 [details] Running same program using different libc Free does not seem to free the chunk or does not mark it as free. See attachment, i use version 2.26 on archlinux x86_64.I also tried with an ubuntu libc 2.26, same result. I don't know if it's a bug or a feature ..
(In reply to ghozt from comment #0) > Created attachment 10554 [details] > Running same program using different libc > > Free does not seem to free the chunk or does not mark it as free. > > See attachment, i use version 2.26 on archlinux x86_64.I also tried with an > ubuntu libc 2.26, same result. > > > I don't know if it's a bug or a feature .. How are you deciding that the chunk is not free? Please see this document for the relevant details: https://sourceware.org/glibc/wiki/MallocInternals If that answers your questions, please mark this bug closed.
Well, in fact, there is a free(c) in the programm. But if we make a malloc of the same size, the chunk is allocate. So effectively, it is free. But last bit of the previous size still remains at 1. So it's not a bug of glibc, but either I did not read the good doc of glibc or the doc is not uptime. Thonks to have read. I think this can be closed. PS: I know my english is bad.
If you are using the latest glibc, you have the per-thread cache enabled. Chunks stored in the cache are still "in use" as far as the malloc internals are concerned (i.e. they won't participate in consolidations). To see what I mean, set GLIBC_TUNABLES=glibc.malloc.tcache_count=0 in your environment to disable the cache.
Really thinks :) It's a great beginning of explain what happens. F.B
(In reply to dj@redhat.com from comment #3) > If you are using the latest glibc, you have the per-thread cache enabled. > Chunks stored in the cache are still "in use" as far as the malloc internals > are concerned (i.e. they won't participate in consolidations). To see what > I mean, set GLIBC_TUNABLES=glibc.malloc.tcache_count=0 in your environment > to disable the cache. Makes sense, thanks for your answer :) I close the issue. Regards, ghozt