orphaned-objects

Prevent orphaned objects in DB4O when updating fields

I want to store Person objects in DB4O. The Person Location field can be changed over time. So I retrieve a person from the DB and call a method to set the location field to a new Location object. (I want the Location objects to be immutable i.e. DDD Value Objects). This works, however the previously assigned Location objects remain the...

How can I dispose of an object (say a Bitmap) when it becomes orphaned ?

I have a class A providing Bitmaps to other classes B, C, etc. Now class A holds its bitmaps in a ring queue so after a while it will lose reference to the bitmap. While it's still in the queue, the same Bitmap can be checked out by several classes so that, say, B and C can both hold a reference to this same Bitmap. But it can also hap...

How to identify orphaned nodes

I have a hierarchy of nodes stored in DB. I select all, store them in an array, then iterate over them and create a nested array in memory. The input looks like this: [{name: A}, {name: B}, {name: X, parent: A}, {name: Y, parent: A}, {name: C}] The output looks like this: [{name: A, children:[{name: X}, {name: Y}]}, {B}, {C}] ...