implemented getMemory in vm and sim