Add assertions on memory allocations.