> What else do you need?
A guarantee that this "allocator function" is only ever called once.
A guarantee that this "allocator function" is only ever called once.
Use whatever mechanism is available to you. Use a global condition variable, check it atomically every time you're entering your custom allocator, increment after a successful allocation. I don't know your system's constraints, nor should I...
If I pass in an allocator that returns the statically allocated buffer, then the second call to it must abort loudly.