add malloc, realloc, free and some debug functions in memory.c