[RFC] Add missing function attributes to functions in memory.h #806

Hi, 

This fixes issue #806. Any feedback or suggestions would  be greatly appreciated. 

Thanks!
@aktau OK. Let's merge it then. :+1: