2 ms·
> Like what? I can only think of one, which is passing memory allocated in one thread to another thread. How would you implement a graph that requires heap all
by tsimionescu 4y ago
> Like what? I can only think of one, which is passing memory allocated in one thread to another thread.
How would you implement a graph that requires heap allocation for each node and supports adding/removing nodes and links with purely scope-based memory management (no shared_ptr or equivalent, no tracing GC), while still reclaiming memory as soon as possible (so no arena-based solutions)?
There are also single-threaded concurrent scenarios where object ownership can be ambiguous, but those are similar to the multi-threaded scenarios you discuss.
- CyberDildonics 4y agoIn the case of nodes in a graph, you have to keep track of where the connections go anyway, so you can count the list of connections.