first version of get_memory