[
https://issues.apache.org/jira/browse/DERBY-3354?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Anurag Shekhar updated DERBY-3354:
----------------------------------
Attachment: derby-3354_v1.diff
Description of derby-3354_v1.diff
This patch introduces a new WeakHashMap in EmbedConnection. EmbedBlob and
EmbedClob objects references are stored in this
map (objects as key and null as value). Adding entry to locater map is
differed till the first call of getLocater.
This ensures that there is entry of LOB objects in locater map if they are
invoked in embedded mode.
As the keys of WeakHashMap doesn't prevents the objects from being
garbage collected, once the lob objects are unreferenced lob objects will
be garbage collected releasing the memory.
During commit/rollback or Connection.close, free is invoked on all the lob
objects from WeakHashMap and the map is cleared.
Modified files
java/engine/org/apache/derby/impl/jdbc/EmbedConnection.java
Added a new attribute lobRefrences of type WeakHashMap.
Added a new method addLOBReference to make an entry in new
hash map.
Modified clearLOBMapping to use lobRefrences to fetch and invoke free on lob
objects instead of lobHashMap.
java/engine/org/apache/derby/impl/jdbc/EmbedBlob.java
java/engine/org/apache/derby/impl/jdbc/EmbedClob.java
Modified constructs to call connection.lobRefrences instead of
conn.addLOBMapping.
Modified getLocater method to check if the locater value is non zero
before returning and if its zero calling conn.addLOBMapping to make
entry of lob objects and getting locater value.
Calling removeLOBMapping in free method.
Cleanup of temporary file is already being taken care by the finalizer of
LOBStreamControl so I haven't added any new cleanup code for
finalizer.
lang and jdbcapi junit tests running clean with this patch applied. I am
running rest of the test suite and will update the results of the same.
> Select from large lob table with embedded gives OutOfMemoryError
> ----------------------------------------------------------------
>
> Key: DERBY-3354
> URL: https://issues.apache.org/jira/browse/DERBY-3354
> Project: Derby
> Issue Type: Bug
> Components: SQL
> Affects Versions: 10.3.1.4, 10.3.2.1, 10.4.0.0
> Reporter: Kathey Marsden
> Assignee: Anurag Shekhar
> Attachments: derby-3354.diff, derby-3354_preview.diff,
> derby-3354_v1.diff, LocLeak.java
>
>
> Retrieving from a large table with lobs gives an OutOfMemoryException, even
> if free() is explictly called on the lob. I believe this is because
> EmbedConnection.addLobMapping is called for every lob creation but is never
> cleared until commit or rollback, even if the lob is freed.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.