In environment that has many instances of custom heap allocators,
are the following statements correct? :-
Each allocated pointer should be encapsulated in a type (e.g.
Ptr)
that cache pointer of who allocated me (Allo*) e.g.class Ptr={ Allo* alloPtr; //<-- to keep track public: void delete(){ //call back to something like "a.deallocate()" } } Allo a; //a custom allocator Ptr<X> x=a.allocate<X>(); x.delete();I think I need to do that to make
delete()easier.If the allocator is more complex, e.g. internally keep a lot of chunks :-
Ptrshould keep track which chunk it resides on, OR
there must be some tiny flag before the allocated content :-Otherwise, I have to iterate each chunk to find the address -> low performance.
Sorry if this is too newbie, I am very new to custom allocators.
It is not homework - I am trying to improve my game library.
I have read :-

