-
Notifications
You must be signed in to change notification settings - Fork 860
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
Tuning excessive memory retention #351
Comments
Thank you for the report; (if you can create a binary that I could run to repro locally that would be great, but I can see that usually not so easy).
Generally,
Hope there is something we can do here. |
Thanks for your quick reply. I have a question, first, and some more data below. Is there a way to create a custom heap, use it, and on destruction force returning all its memory to the OS?
I'll try to make one. Possibly it's enough to copy files in memory, without even parsing them.
no, but we see an identical behaviour on macosx, linux and freebsd.
no, it's release 1.6.3, I believe.
sorry for the dumb question... so
without being ever returned to the OS.
Thanks, we will try.
we tried calling either I'm totally confident that
thanks, I'll try and let you know. |
Ok, here's a minimal example, which possibly reproduces this beheviour.
We compiled with mimalloc 1.6.7 in linux and put ~ 580MB in
So, RSS (RES) is 580MB. After the thread is gone, it's still 580MB. In freebsd the behaviour is almost identical, except that |
Hi,
just want to share some information about an experiment we did, that looks a bit suspicious.
We have a binary that starts doing nothing, periodically it picks a random thread from a pool of 20, this thread iterates through a directory full of fairly large xml files (kept fixed, say, 10 files, 50 MB each); each file is parsed using
pugixml
(a DOM parser, that basically copies the entire file in memory in a big string), and then all the data is dropped (for the purpose of this experiment, we just return true/false if the file was valid xml).In particular, everything happens within a single thread: the parser is created, triggered and destroyed every time; nothing is passed to another thread. Also, there are no leaks, as we also run it under valgrind (without mimalloc).
What we noticed is that whenever a new thread in the pool picks up the task, memory grows significantly (say 150MB), and never decreases; then, when the same thread runs again, memory consumption is roughly flat.
These numbers would be explained if mimalloc does not return the memory back to the OS.
Here's what we tried so far:
we tried using a different heap for the xml parser (pugixml supports passing two pointers to "malloc" and "free"). that was by far the worse solution. the heap grows as much as 4GB during parsing, and when we destroy it, about 25% is kept by the process.
we tried destroying the threads after parsing. basically no effect, memory usage is slightly higher during parsing, and eventually no memory is released to the OS.
Is there anything we should tune?
thanks in advance for the hints
The text was updated successfully, but these errors were encountered: