mimalloc icon indicating copy to clipboard operation
mimalloc copied to clipboard

Analysing allocator CPU & memory issues

Open Pzixel opened this issue 3 months ago • 1 comments

I have a problem with mimalloc and I'm a bit unsure how to approach it. My application consumes a lot of memory using glibc allocator, so I switched to mimalloc. It works wonders, except when it doesn't. Sporadically I can see following pattern in my application:

Image

I know for a fact that there is no user code in the application that can spike into 100% CPU and 5x memory usage. I am pretty sure it's an allocator (and this graph looks very different on glibc allocator). This only happens in production environment on real data, and I haven't been able to create a MRE to showcase the isssue.

Is there any way I can tell why/how this is happening, if I am unable to shrink the issue to the MRE? Maybe I can create a worker to log some of the internal mimalloc structs, so when this happens we have some numbers to work from? At this point I'm a bit lost because I haven't had such problems before and I am not sure how to approach it.

Pzixel avatar Sep 19 '25 16:09 Pzixel

Curious if you've run the application through ASAN. I'd often see that kind of pattern with, well, things that ASAN will find for you, where I'd be thinking, why is this thing being such a dog right now, and ultimately the root cause would be found to be a subtle heap bug that, while non-fatal, certainly made its presence known.

bazineta avatar Oct 06 '25 20:10 bazineta