merge alloc routine for memory checker

only used if explicitly enabled