www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Re: GC & IRC Server

reply Sean Kelly <sean invisibleduck.org> writes:
Rory Mcguire Wrote:
 Surely all programs that have logging use the GC extensively? I have had a
 problem with Java and log4j where the entire heap gets used up and its 
 mostly because of unfreed concatenation of strings for logging e.g.:
 logger.info("connection from"~ socket.remoteAddress());

I would certainly hope not. Loggers shouldn't allocate any memory at all, except perhaps the occasional buffer increase if they're doing something tricky. I can't believe anyone would create a logger that expected the user to perform string concatenation for formatted output. Then again, the Java standard library churns through memory like a Tasmanian Devil on an eating binge, so perhaps I shouldn't be terribly surprised.
Jul 27 2010
parent Rory Mcguire <rjmcguire gm_no_ail.com> writes:
Sean Kelly wrote:

 Rory Mcguire Wrote:
 Surely all programs that have logging use the GC extensively? I have had
 a problem with Java and log4j where the entire heap gets used up and its
 mostly because of unfreed concatenation of strings for logging e.g.:
 logger.info("connection from"~ socket.remoteAddress());

I would certainly hope not. Loggers shouldn't allocate any memory at all, except perhaps the occasional buffer increase if they're doing something tricky. I can't believe anyone would create a logger that expected the user to perform string concatenation for formatted output. Then again, the Java standard library churns through memory like a Tasmanian Devil on an eating binge, so perhaps I shouldn't be terribly surprised.

:D okay, so you're saying avoid string concatenate as much as possible? Will lots of string concatenates always make the GC go crazy?
Jul 29 2010