Included onFree() function for when allocations are collected.