harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "deven you (JIRA)" <j...@apache.org>
Subject [jira] Commented: (HARMONY-6470) [classlib][luni] Scanner will exhaust all heap memory when parse a large file
Date Tue, 16 Mar 2010 02:46:27 GMT

    [ https://issues.apache.org/jira/browse/HARMONY-6470?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12845667#action_12845667

deven you commented on HARMONY-6470:

Since this path is a little complex, let me give some some explains.

The main modification is in Scanner.expandBuffer(), originally it simply uses a new larger
char buffer to replace the old one, and copy all from the old one, so all properties (charbuffer
length, capacity, limit and Scanner's findStartIndex, preStartIndex, cacheHasNextIndex and
etc. )related to the old buffer won't change.

However in this patch, Scanner will try to discard the contends which are not used any longer
in the current char buffer(which also may be replaced by a larger one)  and only keep that
will used for next Scanner.hasNext() or Scanner.next(), so the properties related to the char
buffer also need be changed. 

The next point is this patch add 2 instance variables tokenStart and tokenEnd which were just
2 local vars in Scanner.setTokenRegion(), since the char buffer's properties now may be changed
at any time, now methods(like findPreDelimiter() and findPostDelimiter() etc.) which track
the start index and end index need change this 2 vars at any moment.

if any one would like to try this patch? Thanks a lot!

> [classlib][luni] Scanner will exhaust all heap memory when parse a large file
> -----------------------------------------------------------------------------
>                 Key: HARMONY-6470
>                 URL: https://issues.apache.org/jira/browse/HARMONY-6470
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>    Affects Versions: 5.0M14
>            Reporter: deven you
>             Fix For: 5.0M14
>         Attachments: HARMONY-6470.diff, HARMONY-6470_v2.diff, HARMONY-6470_v3.diff
>   Original Estimate: 96h
>  Remaining Estimate: 96h
> Please see the attached file

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

View raw message