• Meir Shpilraien (Spielrein)'s avatar
    Added new defrag API to allocate and free raw memory. (#13509) · d3d94ccf
    Meir Shpilraien (Spielrein) authored
    All the defrag allocations API expects to get a value and replace it, leaving the old value untouchable.
    In some cases a value might be shared between multiple keys, in such cases we can not simply replace
    it when the defrag callback is called.
    
    To allow support such use cases, the PR adds two new API's to the defrag API:
    
    1. `RM_DefragAllocRaw` - allocate memory base on a given size.
    2. `RM_DefragFreeRaw` - Free the given pointer.
    
    Those API's avoid using tcache so they operate just like `RM_DefragAlloc` but allows the user to split
    the allocation and the memory free operations into two stages and control when those happen.
    
    In addition the PR adds new API to allow the module to receive notifications when defrag start and end: `RM_RegisterDefragCallbacks`
    Those callbacks are the same as `RM_RegisterDefragFunc` but promised to be called and the start
    and the end of the defrag process.
    d3d94ccf
defragtest.c 8.16 KB