Skip to content
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

mi_new(256) distribute 64M Virtual Memory #966

Open
xty438307820 opened this issue Nov 28, 2024 · 1 comment
Open

mi_new(256) distribute 64M Virtual Memory #966

xty438307820 opened this issue Nov 28, 2024 · 1 comment

Comments

@xty438307820
Copy link

I try to call mi_new(256) in mimalloc-2.0.6. Then use top to see the VIRT, I found the VIRT increase 64M, why I just need 256B, the mimalloc mmap 64M memory. Can I decrease this value. Incase I want to run many robot process, every process need extra 64M is too large.

int main()
{
mi_new(256);
while(1);
return 0;
}

Thank you!

@daanx
Copy link
Collaborator

daanx commented Dec 16, 2024

Mimalloc always reserves memory space up front -- but it's virtual; that is, just some numbers to the OS. Only later it will commit on-demand. I guess you are on 32-bit though -- in such case the virtual reservation is a bit limiting since we only have 4GiB virtual; in that case you could give a smaller arena reservation, like MIMALLOC_ARENA_RESERVE=8MiB ... but not much lower though since segments are 4MiB on 32-bit. Mimalloc may not be the right allocator if you have many processes in a 32-bit environment that all compete for virtual memory (but isn't virtual memory 4GiB per process ? -- in that case there as no problem since arena's are shared between threads)

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

No branches or pull requests

2 participants