Stream: git-wasmtime

Topic: wasmtime / issue #2995 Is there a way to free memory allo...


view this post on Zulip Wasmtime GitHub notifications bot (Jun 17 2021 at 11:52):

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 the Store 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.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 17 2021 at 14:40):

alexcrichton commented on issue #2995:

I believe for your type that implements LinearMemory if you implement Drop that should be a hook to deallocate memory? Nothing will get dropped until the Store is dropped, but otherwise we should still run the destructors of all memories when the store is dropped.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 17 2021 at 18:08):

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 the Store 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.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 17 2021 at 18:09):

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.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 18 2021 at 05:40):

athei commented on issue #2995:

Yes that did work. The Drop implementation is called. Thanks a lot.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 18 2021 at 05:40):

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 the Store 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: Dec 23 2024 at 12:05 UTC