void *mmalloc(size_t size)
{
G_inUse += size;
return malloc(size);
}
void mfree(void *p)
{
size_t *sizePtr=((size_t *) p)-1;
G_inUse -= *sizePtr;
free(p);
}
Here if we request 10 bytes of memory, malloc will allocate 11 byte(for ex: address is 2000 means 1999 will have size of the alloceated memory)
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.