Anonymous | Login | Signup for a new account | 11-21-2024 15:47 PST |
Main | My View | View Issues | Change Log | Docs |
Viewing Issue Simple Details [ Jump to Notes ] | [ View Advanced ] [ Issue History ] [ Print ] | |||||||||||
ID | Category | Severity | Reproducibility | Date Submitted | Last Update | |||||||
0004100 | [Hessian] | minor | always | 07-01-10 08:08 | 07-01-10 08:08 | |||||||
Reporter | ferg | View Status | public | |||||||||
Assigned To | ||||||||||||
Priority | normal | Resolution | open | |||||||||
Status | new | Product Version | ||||||||||
Summary | 0004100: replace StringBuffer with StringBuilder for Android | |||||||||||
Description |
(rep by dilbert.elbonia) I ran into this issue while using Hessian on the Android platform. Android version 1.6 is severely affected and the problem is less serious on 2.1. In short the Hessian class com.caucho.hessian.io.Hessian2Input uses (and reuses) a private member StringBuffer _sbuf. Here is a snippet from said class: case 0x30: case 0x31: case 0x32: case 0x33: _isLastChunk = true; _chunkLength = (tag - 0x30) * 256 + read(); _sbuf.setLength(0); while ((ch = parseChar()) >= 0) _sbuf.append((char) ch); return _sbuf.toString(); This piece of code reads a char from the input and appends it to the _sbuf. When finished it returns the string to the caller via the toString() call. Due to an error in the Andriod implementation (for details check: http://code.google.com/p/android/issues/detail?id=9435) [^] it is possible that the call will return a string that occupies far more memory space than needed which is very bad on mobile devices. Also it seems that earlier Java implementations suffered from a similar problem: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4259569 [^] Since this is not strictly a Hessian bug I am reluctant to post a bug report but maybe a replacement of StringBuffer with a local StringBuilder should be considered. I made the replacement in my version and it solved the problem. |
|||||||||||
Additional Information | ||||||||||||
Attached Files | ||||||||||||
|
There are no notes attached to this issue. |
Mantis 1.0.0rc3[^]
Copyright © 2000 - 2005 Mantis Group
26 total queries executed. 24 unique queries executed. |