Improve var names in get_memory

Backport from master