elements from a query and I'm lacking a good understanding of how
to make sure that Cayenne can garbage collect it's objects.
Perhaps there are some do's and don'ts, but I don't know what they are at this
For my purposes it doesn't matter how much memory Cayenne uses to
handle a small number of objects, but it becomes a problem if
the memory consumption is proportional to the # of objects returned
from a query.
I'm running Cayenne 3.x
1. Consider the code below. Will all the objects from the query
be locked in memory?
query.setPageSize(1000); /* does this matter? */
/* Does performQuery return a clever implementation of
a List that does not lock the CayenneDataObjects into memory?
Foo f=(Foo) i.next();
.... do some processing here that ...
2. When does peak memory usage occur above?
3. Can a CayenneDataObject be garbage collected as long as it's
DataContext is in scope?
I'm wondering because as far as I have understood the two if
statements below are equivalent when a & b are CayenneDataObjects
in the same DataContext.
That is if 'a' can be garbage collected during the lifetime of the
DataContext, then 'a' is points to different objects during the
lifetime of CayenneDataObject's and a==b just 'barely' works.
If any information is stored in 'a' then it can be garbage collected
during the lifetime of the CayenneDataContext.
4. Should I consider some "clever" implementation of a query that
ensures that only a small amount of CayenneDataObject's are
locked in memory at the time?
- use performIteratedQuery() w/setPageSize()
- ResultIterator.nextDataRow() is a bit strange: it returns a Map<>, but
perhaps I can safely upcast that.
- use objectFromdataRow()
ARM7 ARM9 XScale Cortex
JTAG debugger and flash programmer