Add custom allocator support used the realloc() interface

Signed-off-by: Alejandro Mery <amery@geeks.cl>