harmony-commits mailing list archives

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

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

Tim Ellison commented on HARMONY-6470:
--------------------------------------

Deven,

Thanks for the patch.

Rather than create a temp file of 8 << 21 (16777216)  * 11 bytes and then reading it
back into the scanner, do you think it would be better to have a Reader that returns the bytes
in memory?  I think the test will be more robust and faster that way.

Something like this:

public class MyReader extends Reader {

    static final char[] CONTENT = "Large file!\n".toCharArray();

    @Override
    public void close() throws IOException {
    }

    @Override
    public int read(char[] buf, int offset, int count) throws IOException {

        for (int i = offset, j = 0; j < count; i++, j++) {
            buf[i] = CONTENT[j % CONTENT.length];
        }
        return count;
    }
}


> [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
>
>   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.


Mime
View raw message