mlua
mlua copied to clipboard
Add `Lua::(reset_)num_allocations` API
I was in need to track the number of memory allocations, so added an API to support this.
Lua::num_allocationssimply returns a number of allocations invoked by Lua runtime since the runtime has been created.Lua::reset_num_allocationsresets the counter.
Thanks for the PR!
Seems the current version has breaking changes (renaming MemoryLimitNotAvailable to MemoryStatsNotAvailable) which makes it hard to include into v0.9 branch.
Wondering, would be better to keep the original error code and add a new one (Error enum is non_exhaustive so it's not breaking change).
I'm happy to merge error codes into a single one in the next major release.