jrouwe/JoltPhysics

Setting custom memory allocator when targetting WASM

Closed this issue · 4 comments

In Core.h, when JPH_PLATFORM_WASM is defined, JPH_DISABLE_CUSTOM_ALLOCATOR is defined.
Why is that?
It would be useful to be able to override the allocator functions (I use it for counting total mem usage).

I can make it possible to enable it, the main use case for WASM was to have a JavaScript version of Jolt and that didn't need it.

I would like it. Since I'm building my Emscripten/WASM program with a fixed memory budget (due to that memory growth bug), it's helpful to be able to see the total mem usage of the program. And I guess web browsers have \more constrained memory in general.

B.t.w. Measuring memory can also be done in this way:

https://github.com/jrouwe/JoltPhysics.js/blob/aefd381f5588614abc4d71f32b96f904c78af61b/JoltJS.h#L408-L423

Ah yeah that will be helpful, thanks.