[ 
https://issues.apache.org/jira/browse/DERBY-4294?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12725981#action_12725981
 ] 

Kristian Waagan commented on DERBY-4294:
----------------------------------------

I think this may be related to prefetching and the default heap size on 
Windows. If the Sun JVM was used, I think the maximum heap size is set to 64 MB 
(only client mode on Windows).

If I disable prefetching (derby.language.bulkFetchDefault=1) I'm able to run 
the select with 10.3 using a 38 MB heap. With 10.6 I get away with a 37 MB heap.
I don't know the minimum overhead of Derby, but after running a values clause 
in ij I see a heap usage of about 2 MB. After the select it rises to about 30 
MB. Of these, around 26 MB are byte arrays, and I believe these are the page 
cache. Since Derby is asked to produce strings from the byte arrays 
representing the Clobs, we need heap space for these strings as well. If the 
prefetch is set to 16 rows, all 14 rows will be fetched at once. 30 + 23 = 53 
MB.
The remaining 11 MB must be data from the other columns and overhead. With 
prefetch disabled, Derby/Java is able to discard some of the data during result 
set processing.

It is not clear to me that there is anything wrong with the Clob handling in 
this case.

> java.lang.OutOfMemoryError from mailjdbc test after running for one hour from 
> select * from REFRESH.INBOX
> ---------------------------------------------------------------------------------------------------------
>
>                 Key: DERBY-4294
>                 URL: https://issues.apache.org/jira/browse/DERBY-4294
>             Project: Derby
>          Issue Type: Bug
>          Components: Store
>    Affects Versions: 10.3.3.0
>         Environment: Window Vista
>            Reporter: Lily Wei
>         Attachments: Derby4294_pid6920.zip, Heapspaceerror.zip
>
>   Original Estimate: 0h
>  Remaining Estimate: 0h
>
> After running mailjdbc test on 10.3 branch, select * from REFRESH.INBOX gave 
> me error like:
> ERROR XJ001: Java exception: 'Java heap space: java.lang.OutOfMemoryError'
> I also see the same error on 10.5 branch. 
> I inculde my mailsdb directory in this bug too.
> How to reproduce this issue:
> 1. cd mailjdbc
> 2. java org.apache.derbyTesting.system.mailjdbc.MailJdbc embedded
> 3. Wait for an hour and ignore Primary key violation error 
> ( : INFO :Refresh Thread : Error while inserting attachments:The statement 
> was ab
> orted because it would have caused a duplicate key value in a unique or 
> primary
> key constraint or unique index identified by 'ATTACH__PK' defined on 
> 'ATTACH'.)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to