Always define onMemoryAllocated