Add memory log function