mimalloc icon indicating copy to clipboard operation
mimalloc copied to clipboard

Call mi_heap_destroy from another thread

Open TemplateVoid opened this issue 2 years ago • 1 comments

Hi. I have a little question... I create a heap (mi_heap_new) and allocate memory (mi_heap_malloc) in child thread. Can i call mi_heap_destroy from main thread?

TemplateVoid avatar Aug 28 '23 20:08 TemplateVoid

I create a heap (mi_heap_new) and allocate memory (mi_heap_malloc) in child thread. Can i call mi_heap_destroy from main thread?

Hi, I would like to see this question answered as well.

According to the comment: Heaps: first-class, but can only allocate from the same thread that created it.

But is it valid to free it outside of the creating thread ? (as of mimalloc 2.1.9 ?)

d-musique avatar Feb 27 '25 16:02 d-musique