Rewrite get_memory_info

Rewrite get_memory_info, thanks to scott.

Signed-off-by: Chuck Short <chuck.short@canonical.com>
(cherry picked from commit 28283fcb372341464f7ad0e0f9c4d7ec0e023fae)