aerospike / aerospike-client-go

Aerospike Client Go
Apache License 2.0
430 stars 198 forks source link

Resolve memory leak caused by circular reference in client finalizer #441

Closed reugn closed 1 month ago

reugn commented 2 months ago

A circular reference between the client object and the cluster object prevents the client's finalizer from executing, resulting in a memory leak. The issue can be reproduced by creating and closing multiple client instances in a loop. To resolve this, the client instance has been injected into the batch commands directly.

khaf commented 2 months ago

@reugn Thanks for the pull request. Is the issue the finalizer not being called, or the memory leak after the finalizer call?

reugn commented 2 months ago

The finalizer is not being called, causing the memory leak.