> I'd love to see this kind of thing get easier / better supported.

I can write a proposal, it would essentially be:
    
    
    when defined(nimOverrideAllocator):
      proc overrideAllocator(
        allocPtr: proc (size, align: Positive): pointer {.nimcall, raises: [], 
tags: [], gcsafe.},
        deallocPtr: proc (p: pointer; size: Positive) {.nimcall, raises: [], 
tags: [], gcsafe.},
        reallocPtr: proc (p: pointer; size, oldSize, align: Positive): pointer 
{.nimcall, raises: [], tags: [], gcsafe.})
    
    
    
    Run

It should be opt-in as allocation is often on the critical path IME and proc 
pointers are not inline-able.

Reply via email to