c malloc functionality for custom memory region -


is there malloc/realloc/free implementation can specify memory region manage memory allocation?

i mean regular malloc (etc.) functions manages heap memory region. if need allocate space in shared memory segment or in memory mapped file?

not 100 %, per question want maintain own memory region. need go own my_malloc, my_realloc , my_free

implementing own my_malloc may you

void* my_malloc(int size)     {     char* ptr = malloc(size+sizeof(int));     memcpy(ptr, &size, sizeof(int));     return ptr+sizeof(int);  } 

this small idea, full implementation take answer.

refer question

use same method achieve my_realloc , my_free


Comments