simple implementation of malloc and free