remove mem allocation and free