You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Kev Jackson <ke...@it.fts-vn.com> on 2006/04/19 06:17:57 UTC

1.7 Memory usage > 1.6.5 Memory usage

Just trying to reduce the amount of temporary objects created on the 
heap to resolve this OutOfMemory issue with AppFuse, and with the 1.6.5 
source, I can reduce memory consumption by putting a guard around when 
Strings are created for logging eg:

log("Copying "+fromFile+" to "+toFile, verbosity)

becomes

StringBuffer sb = new StringBuffer("Copying ").append(fromFile).append(" 
to ");
... (code elided)
//not the same behaviour, but need to try  and see : don't log unless 
user wants debug output
if (verbosity >= Project.MSG_DEBUG) {
  log(sb.append(toFile).toString(), verbosity);
}

This helps as the strings aren't created at all unless the verbosity is 
set to DEBUG, however, in Ant 1.7, even with this change, there is an 
OutOfMemory error.  Basically some of the 1.7 tasks are consuming much 
more memory than the 1.6.5 codebase.

In general though, the logging mechanism is always going to create a lot 
of temporary cruft as it stands, and this is perhaps one area where 
there could be some refactoring?



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


Re: 1.7 Memory usage > 1.6.5 Memory usage

Posted by Alexey Solofnenko <tr...@gmail.com>.
The change you mentioned would only affect performance, not memory usage.
Have you tried to run ANT in any profiler to see where most of the memory is
allocated?

- Alexey.

On 4/18/06, Kev Jackson <ke...@it.fts-vn.com> wrote:
>
> Just trying to reduce the amount of temporary objects created on the
> heap to resolve this OutOfMemory issue with AppFuse, and with the 1.6.5
> source, I can reduce memory consumption by putting a guard around when
> Strings are created for logging eg:
>
> log("Copying "+fromFile+" to "+toFile, verbosity)
>
> becomes
>
> StringBuffer sb = new StringBuffer("Copying ").append(fromFile).append("
> to ");
> ... (code elided)
> //not the same behaviour, but need to try  and see : don't log unless
> user wants debug output
> if (verbosity >= Project.MSG_DEBUG) {
>   log(sb.append(toFile).toString(), verbosity);
> }
>
> This helps as the strings aren't created at all unless the verbosity is
> set to DEBUG, however, in Ant 1.7, even with this change, there is an
> OutOfMemory error.  Basically some of the 1.7 tasks are consuming much
> more memory than the 1.6.5 codebase.
>
> In general though, the logging mechanism is always going to create a lot
> of temporary cruft as it stands, and this is perhaps one area where
> there could be some refactoring?
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
> For additional commands, e-mail: dev-help@ant.apache.org
>
>


--
Alexey N. Solofnenko trelony at gmail.com
home: http://trelony.cjb.net/
Pleasant Hill, CA (GMT-8 hours usually)