Skip to content

runtime: plan9 system allocator leaks memory #9736

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
dvyukov opened this issue Jan 30, 2015 · 0 comments
Closed

runtime: plan9 system allocator leaks memory #9736

dvyukov opened this issue Jan 30, 2015 · 0 comments

Comments

@dvyukov
Copy link
Member

dvyukov commented Jan 30, 2015

Plan9 memory allocator (sysAlloc/sysFree) does not actually free memory. It can free only the last allocated block.

Most of the memory in runtime is persistent so it did not hit us very badly.
However, there are several cases where runtime grows arrays by factor of 2, e.g. alloc 4K; alloc 8K; free 4K; alloc 16K; free 8K and so on. Also execution tracer allocates a bunch of 64K blocks and frees them when tracing stops. These will lead to leaks whenever you trace your server.

The easiest thing to do is to add a freelist of blocks of size 64K only (in sysFree/sysAlloc). This will eliminate the tracer leaks.
The more comprehensive fix is to implement a sorted freelist with coalescing and splitting.

@0intro @ality

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants