Fix warnings in memory.cpp