commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 36352] - [io] create memory efficient ThreadableInputStream
Date Fri, 26 Aug 2005 07:59:49 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=36352>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=36352


hauser@acm.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |NEEDINFO




------- Additional Comments From hauser@acm.org  2005-08-26 09:59 -------
If you start by having a byte[] e.g. in a singleton, your argument is right.
However if you start by having a ByteArrayInputStream (e.g. received from mysql
jdbc), each time you construct a new ByteArrayInputStream for an additional
thread by doing a java.io.ByteArrayInputStream.read(byte b[], int off, int len)
where len equals the entire array length as per available(), to obtain the
byte[] for constructing the java.io.ByteArrayInputStream for the next Thread,
you always get a System.arraycopy(buf, pos, b, off, len), so by allocating b,
your memory consumption grows with each additional thread.

So, yes, by actively managing one single byte[] once instead of a
ByteArrayInputStream and use it to construct a java.io.ByteArrayInputStream for
each Thread, a ThreadableInputStream class may become obsolete.
So, if you think this pattern is the way to go I am fine with resolving this as
"WONTFIX" - what do you think?

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message