How to release gcs::Client resources #6483
-
Hi, My code encapsulates During authentication, I reset it with I need to hold the object across multiple read/write operations that may be invoked in multiple threads. How should I release the previous instance of client in such case? Even if I don't overwrite the object, our code's memory allocation gear reports memory leak of 192 bytes with above bare bone operations. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Think of
but this is not:
With that out of the way:
Does it say where? It could be a bug that our memory allocation stuff does not detect, or it could be a false positive. FWIW, we mostly use AddressSanitizer to check for memory leaks, but I have used valgrind from time-to-time. |
Beta Was this translation helpful? Give feedback.
Think of
gcs::Client
as astd::shared_ptr<>
: copying them is "cheap", also, two copies pointing to the same shared state can be used from two different threads, i.e., this is safe:but this is not:
With that out of the way:
Does it say where? It could be a bug that our memory allocation stuff does not detect, or it cou…