Add memory allocate and release