modify processing to allocate and free heap