SFBdragon/talc

Making the OOM handler system more powerful

Closed this issue · 1 comments

The oom_handler API is not enough for more complex things at the moment. I might need to swap the oom_handler function pointer out for a trait object/generic (Talc::with_oom_handler(&mut dyn OomHandler) or Talc<OomHandler> or ???) so that the handler can be stateful without forcing global/threadlocal state, and I'm thinking of using the internal allocation tags' IS_ALLOCATED (would get renamed) flag to allow for special allocation handling (e.g. adding support for hosted environments, including mmap-ing big allocations outside of the arena and other stuff).

However I'll wait until there's a good use-case for doing that.

This will require a major version bump.

Half done: v2 adds allowance for safe, stateful OOM handling using generics. The current API doesn't accommodate special allocation handling though yet. That'd have to be in v3, if a clear use for it is established. Closing as completed; I'll leave further discussion to new issues.