Update memory related functions

Signed-off-by: Yiqiao Pu <ypu@redhat.com>