Opened 5 years ago
Last modified 5 years ago
#15996 new bug
heap memory is not released to system
Reported by: | X512 | Owned by: | nobody |
---|---|---|---|
Priority: | normal | Milestone: | Unscheduled |
Component: | System/libroot.so | Version: | R1/Development |
Keywords: | Cc: | ||
Blocked By: | #13554 | Blocking: | |
Platform: | All |
Description
This is hrev54155.
Test program: https://dev.haiku-os.org/attachment/ticket/15995/MemTest.cpp.
Steps to reproduce:
- Enable
ALLOC_MALLOC
and setallocSize
to 64. - Run program until
totalSize:
message will be displayed. - Press enter and wait until
totalSize: 0
message will be displayed. - Memory is still allocated by test program that can be confirmed by ProcessController or ActivityMonitor.
- Press enter again that will cause program exit and freeing memory.
Change History (3)
comment:1 by , 5 years ago
comment:2 by , 5 years ago
Memory is not released when requested by another process, it just fail. You can run another intance of test program to confirm that.
comment:3 by , 5 years ago
Blocked By: | 13554 added |
---|
Yes, this is because the malloc we use (hoard2) is essentially sbrk-based, so it can only return memory when it can resize/cut the area in a sane way. This should be fixed when we switch to a different allocator that uses mmap() instead.
Note:
See TracTickets
for help on using tickets.
This is expected. The team preserves its heap unless the memory is needed elsewhere (the low_resource_manager would request it to release things). Releasing pages to the system pool and then reclaiming them when a new allocation happens would waste a lot of performance.