I have a server application that continually reads data from sensors. At set intervals the data is summarized. This summary data is used to create Cayenne data objects of type Reading. A short transaction commits these Reading objects to the database, after which it is not important that they are held in memory - they were created only to be stored. After a long period of time their continual collection results in an 'OutOfMemory' JVM condition.
There are many objects of type Reading for another Cayenne data object called SubstancePoint. And there's a whole object graph going back from there. I basically want to keep the whole of the object graph in memory, except for these Reading objects. Is there a way to 'disappear' data objects from the DataContext? For that is what I think would solve my problem. I have tried calling DataContext.unregisterObjects() post-commit on the Reading data objects I want evacuated from memory, but I can see that the leak is still going on. Thank you ~ Chris Murphy