307 words

Issue #91 - Large query parameter - out of memory

BugVersion: Priority: NormalStatus: FixedReplies: 1
2011-11-15 21:10

I have an entity object composed of an id, large data in the form of a string and the hashcode of the string as an index. The attached test saves 2000 of these objects, writing the data to a txt file as it goes. It then loops through the data from the file and queries for the entity id based on the data hashcode and the data itself.

I'm running the test with -Xmx512m - I believe this should be sufficient as I only create/read one item of data at a time and am only querying for the id. After about 300 queries the test throws an out of memory exception so I assume the query data is being held internally. I've tried reducing the query-cache programs setting but this made no difference (I'm not 100% sure if it should anyway...). If you could assist it'd be much appreciated!

The aim behind the test is to create a data cache to prevent the need for large data to be held in memory. The data itself forms part of the query as there are duplicate data entries which I only want to store once in the cache.

thumbripper's picture
Joined on 2011-06-18
User Post #2
2011-11-15 23:40

Your test demonstrates a failure of ObjectDB in evaluating cached query result size.

Since Java doesn't provide information on heap memory size of data structures - ObjectDB does its own evaluation. Every cached result entry contains query request (key) + query result (value). ObjectDB evaluated only the query response, which is usually expected to be larger. In your test the request is very large (the query parameter arguments) and the response is very small. Therefore, even with a small query result cache - ObjectDB kept many cached result entries with their huge query parameter arguments.

Build 2.3.3_06 fixes this issue. Thank you for this report and for the test program.

ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)
support's picture
Joined on 2010-05-03
User Post #745

Post Reply

Please read carefully the posting instructions - before posting to the ObjectDB website.

  • You may have to disable pop up blocking in order to use the toolbar (e.g. in Chrome).
  • Use ctrl + right click to open the browser context menu in the editing area (e.g. for using a browser spell checker).
  • To insert formatted lines (e.g. Java code, stack trace) - select a style in the toolbar and then insert the text in the new created block.
  • Avoid overflow of published source code examples by breaking long lines.
  • You may mark in paragraph code words (e.g. class names) with the code style (can be applied by ctrl + D).
  • Long stack traces (> 50 lines) and complex source examples (> 100 lines) should be posted as attachments.
Maximum file size: 32 MB