tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject DO NOT REPLY [Bug 43925] org.apache.jasper.runtime. BodyContentImpl causing huge memory allocations
Date Sun, 06 Apr 2008 07:10:48 GMT

Brian Remmington <> changed:

           What    |Removed                     |Added
             Status|RESOLVED                    |REOPENED
         Resolution|DUPLICATE                   |

--- Comment #8 from Brian Remmington <>  2008-04-06
00:10:46 PST ---
This is not a duplicate of 37793.

That one is related to the unbounded growth of cb without the ability for the
garbage collector to kick in to collect it. The LIMIT_BUFFER option goes some
way to resolve that problem. Thomas (comment #6) does seem to be suffering from
37793 rather than this one.

*This* problem, however, is about the way in which, while cb grows, large
numbers of exponentially-larger char arrays are reallocated, copied, and

Every time chars are written that cause cb to grow, the following process

a. Allocate a new char array that is twice as large as the current "cb";
b. Copy the contents of cb into the new array;
c. Assign the new array to cb;
d. Garbage collector collects the old cb array.

This, I think, is obviously inefficient. It fills up the heap with large,
unwanted character arrays and forces the garbage collector to activate more
frequently, thus reducing the CPU available for doing useful work. It also uses
CPU to copy exponentially-growing arrays from one block of memory to another.
It is all unnecessary.

My suggested resolution is to improve the way this buffering is managed. No
array copies occur. No unnecessarily large heap allocations occur. Nothing is
left to the garbage collector that doesn't have to be. The performance of this
part of the code is improved. The drain that this code places on system
resources is reduced.

Given that widespread use of various tag libraries, I still feel that this is a
very worthwhile change. 


Configure bugmail:
------- You are receiving this mail because: -------
You are the assignee for the bug.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message