athei opened issue #2995:
I don't see any possibility to de-allocate memory that was created using the
MemoryCreator/LinearMemoryinterface. Shouldn't it be freed when theStoreis dropped?I am asking because I implemented
MemoryCreatorin 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
LinearMemoryif you implementDropthat should be a hook to deallocate memory? Nothing will get dropped until theStoreis 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/LinearMemoryinterface. Shouldn't it be freed when theStoreis dropped?I am asking because I implemented
MemoryCreatorin 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
Dropimplementation 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/LinearMemoryinterface. Shouldn't it be freed when theStoreis dropped?I am asking because I implemented
MemoryCreatorin 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: Dec 13 2025 at 21:03 UTC