bug-classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug classpath/22730] BufferedInputStream allocates too much memory (Out


From: gcc-bugzilla at gcc dot gnu dot org
Subject: [Bug classpath/22730] BufferedInputStream allocates too much memory (OutOfMemory w/ gcj)
Date: 16 Oct 2005 01:26:51 -0000

BufferedInputStream.reset() contains the following:

        // Need to grow the buffer now to have room for marklimit bytes.
        // Note that the new buffer is one greater than marklimit.
        // This is so that there will be one byte past marklimit to be read
        // before having to call refill again, thus allowing marklimit to be
        // invalidated.  That way refill doesn't have to check marklimit.
        byte[] newbuf = new byte[marklimit + 1];
        System.arraycopy(buf, 0, newbuf, 0, count);
        buf = newbuf;


But, marklimit may be an outrageously large number, as in mauve's BigMark test
case, where we get an OutOfMemory exception on Linux with gcj.

We don't really need to allocate such a large array.


------- Comment #1 from from-classpath at savannah dot gnu dot org  2004-04-30 
15:46 -------
This has been fixed (in 0.08) byt the following patch:

2004-03-09  Guilhem Lavaux  <address@hidden>

        * java/io/BufferedInputStream.java (marktarget): New field for max
        mark limit.
        (CHUNKSIZE): New constant for incremental mark buffer allocation.
        (mark): Use new fields.
        (read): Likewise.
        (read(byte[],int,int)): Likewise.
        (skip): Likewise.
        (refill): Likewise.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22730





reply via email to

[Prev in Thread] Current Thread [Next in Thread]