|
|
|
|
|
by btown
4095 days ago
|
|
> the child object seems to depend on memory that it doesn't own a strong reference to Exactly. Having made similar types of robotics interfaces myself, the memory graph for OP probably isn't as complicated/cyclic as you might think: multiple types of frames (at various stages of visualization processing) look into each others' memory buffers for efficiency. It's probably best modeled as an acyclic directed graph where frame objects reference (many-to-many) memory buffers. The problem is that unless you abstract out those buffers into garbage-collectible objects themselves, it's very tempting just to pass a weak reference (like a pointer from JNI) to the buffer owned by an EarlyStageFrame to the processing code in a LaterStageFrame. Thus the segfault when the EarlyStageFrame is garbage-collected. |
|
> It's probably best modeled as an acyclic directed graph
My pet theory is that a good representation for most systems should maybe always be an acyclic directed graph?