allocate and free implemented