Added on_dealloc and on_realloc callbacks