mailing list of musl libc
 help / color / mirror / code / Atom feed
* confusion about brk and mmap in expand_heap in malloc implementation
@ 2015-09-10 18:58 Yuxin Ren
  2015-09-10 20:58 ` Rich Felker
  0 siblings, 1 reply; 2+ messages in thread
From: Yuxin Ren @ 2015-09-10 18:58 UTC (permalink / raw)
  To: musl

[-- Attachment #1: Type: text/plain, Size: 426 bytes --]

Hi,

I found in the __expand_heap function used by malloc, if brk fails, it will
use mmap to get a memory area.
I think in this case, this area should be returned back to system via
munmap.
But in my test, when I free such area, I found it is still passed to
madvise, not munmap.

How do we track if an area is expanded by brk or mmap?
And when we free an area, how do we decide to use munmap or madvise?

Thanks a lot.
Yuxin

[-- Attachment #2: Type: text/html, Size: 1584 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-09-10 20:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-10 18:58 confusion about brk and mmap in expand_heap in malloc implementation Yuxin Ren
2015-09-10 20:58 ` Rich Felker

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).