Had very strange results after calling free twice on same ndarray. After that pool.zeroes started returning buffers that were currently in use. To prevent this, I think you should keep flag with ndarray of it's malloc state and throw error if you are trying to free already released buffer.