mirror of
https://github.com/aljazceru/turso.git
synced 2025-12-24 11:34:21 +01:00
I was baffled previously, because any time that `free` was called on a type from an extension, it would hang even when I knew it wasn't in use any longer, and hadn't been double free'd. After #737 was merged, I tried it again and noticed that it would no longer hang... but only for extensions that were staticly linked. Then I realized that we are using a global allocator, that likely wasn't getting used in the shared library that is built separately that won't inherit from our global allocator in core, causing some symbol mismatch and the subsequent hanging on calls to `free`. This PR adds the global allocator to extensions behind a feature flag in the macro that will prevent it from being used in `wasm` and staticly linked environments where it would conflict with limbos normal global allocator. This allows us to properly free the memory from returning extension functions over FFI. This PR also changes the Extension type to a union field so we can store int + float values inline without boxing them. any additional tips or thoughts anyone else has on improving this would be appreciated 👍 Closes #803