added libmem and a test