It's advisable not to, because if the RTL implementation of malloc changes then your application will start behaving very strangely. Also if the main application passes you a pointer that has not been allocated with malloc (maybe "new", or if the buffer is created on the stack, or via other memory management performed by the application) then the assumption that the size info is at &(ptr-N) will be invalid.