Allocated size of a void pointer
One tricky question is How to know the allocated size of a void pointer without any kernel knowledge? Actually, some kernels store this information with a mapping, from the pointer and size of its heap memory. While, suppose you have know any how to figure them out, one simple solution is to customize the free() and malloc().Read full article from Allocated size of a void pointer