-
Notifications
You must be signed in to change notification settings - Fork 9
Troubleshooting
Tilmann edited this page Feb 2, 2015
·
2 revisions
If you get an java.lang.StackOverflowError
and the Stacktrace contains lines like these:
at org.zoodb.internal.DataDeSerializer.postProcessCollections(DataDeSerializer.java:334)
and these
at YOUR_CLASS_HERE.hashCode(YOUR_CLASS_HERE.java:129)
at java.util.HashMap.hash(HashMap.java:366)
then ZooDB is recursively loading too many objects into the client. Objects are loaded because the objects contain a HashMap (or similar) or other objects. Whenever an object is loaded into memory, 'empty' objects are used fill any HashMaps it has. However, filling such a HashMap involves calling hashCode()
on the empty objects, which in turn causes them to become non-empty (materialised in memory). If these objects also contains HashMaps, then we or loading objects in that HashMap as well.
Solution: Avoid using HashMap (use IdenityHashMap instead), or avoid implementing hashCode(), or use something like this if possible:
@Override
public int hashCode() {
return super.hashCode();
}