J
Jack
Hi,
In multi-thread programming, if I using smart pointers to store
pointers to the same dynamically allocated objects, can memory leak be
avoided?
For example, two threads share the same dynamically allocated objects
using smart pointer. The reference to the shared object is 2. If one
thread crashes before decreasing the reference, then eventually the
reference will still be 1, so the object will not be deleted. So this
is memory leak.
Am I right?
Thanks.
Jack
In multi-thread programming, if I using smart pointers to store
pointers to the same dynamically allocated objects, can memory leak be
avoided?
For example, two threads share the same dynamically allocated objects
using smart pointer. The reference to the shared object is 2. If one
thread crashes before decreasing the reference, then eventually the
reference will still be 1, so the object will not be deleted. So this
is memory leak.
Am I right?
Thanks.
Jack