Hi Daniel,

For testing you can close the `BufferAllocator` used. If assertions are
enabled, `close` will throw an exception if buffers are outstanding. For
production you should test your code well enough to be sure that all
vectors are closed.

Other things that might help to detect memory leaks (in production if you
wish so):
* Child allocators (`BufferAllocator#newChildAllocator`). You can close an
child allocator to release all the memory allocated with it
* `BufferAllocator#getAllocatedMemory`: If this is !=0 this means that you
have still something allocated with this allocator

I hope that helps
Benjamin


On Mon, Sep 13, 2021 at 9:17 AM Daniel Hsu <[email protected]> wrote:

> Hi All,
>
> Is there a way to figure out which vectors I haven't called close() on
> yet? My concern is that if I have a bug in my code where I accidentally
> forget to call close() for many vectors, the space occupied by these
> vectors could grow forever and crash my system.
>
> How do I detect these vector "memory leaks"?
>
> Best,
> Daniel
>

Reply via email to