3 ms·
Doesn't have to be threads, different contexts.
by dvirsky 8y ago
Doesn't have to be threads, different contexts.
- adrianratnapala 8y agoThat's exactly the path to hell. You start using `shared_ptr` because you are too confused about the code to know which of the two "contexts" is supposed to own the thing. So shared_ptr (might) fix your memory freeing problem, but it maintains (and sometimes worsens) the problems caused by having two different contexts that might or might not be alive at any given time. With two different threads however, such problems are often unremoveable, which is why shared_ptr is the right solution mitigation.