athei opened issue #2995:
I don't see any possibility to de-allocate memory that was created using the
MemoryCreator
/LinearMemory
interface. Shouldn't it be freed when theStore
is dropped?I am asking because I implemented
MemoryCreator
in order to make use of a low level macOS feature (purgable memory). In order to do so I need to allocate the 6GB virtual space as two consecutive memory mappings. I run out of virtual space to do so pretty quickly to fit those next to each other (rust runs tests all run in the same process). Or at least the mach kernel sees no way to fit them next to each other once enough tests where run.
alexcrichton commented on issue #2995:
I believe for your type that implements
LinearMemory
if you implementDrop
that should be a hook to deallocate memory? Nothing will get dropped until theStore
is dropped, but otherwise we should still run the destructors of all memories when the store is dropped.
athei edited issue #2995:
I don't see any possibility to de-allocate memory that was created using the
MemoryCreator
/LinearMemory
interface. Shouldn't it be freed when theStore
is dropped?I am asking because I implemented
MemoryCreator
in order to make use of a low level macOS feature (purgable memory). In order to do so I need to allocate the 6GB virtual space as two consecutive memory mappings. I run out of virtual space to do so pretty quickly to fit those next to each other (rust runs tests all run in the same process). Or at least the mach kernel sees no way to fit them next to each other once enough tests were run.
athei commented on issue #2995:
I believe for your type that implements LinearMemory if you implement Drop that should be a hook to deallocate memory?
Now I feel stupid. I will test that.
athei commented on issue #2995:
Yes that did work. The
Drop
implementation is called. Thanks a lot.
athei closed issue #2995:
I don't see any possibility to de-allocate memory that was created using the
MemoryCreator
/LinearMemory
interface. Shouldn't it be freed when theStore
is dropped?I am asking because I implemented
MemoryCreator
in order to make use of a low level macOS feature (purgable memory). In order to do so I need to allocate the 6GB virtual space as two consecutive memory mappings. I run out of virtual space to do so pretty quickly to fit those next to each other (rust runs tests all run in the same process). Or at least the mach kernel sees no way to fit them next to each other once enough tests were run.
Last updated: Nov 22 2024 at 16:03 UTC