www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - GC & IRC Server

reply Mengu <mengukagan gmail.com> writes:
Hi all,

I was reading an IRC server's codes which was C++ and thought how possible it
was with D and started a
discussion in the #d room in freenode. Yet I'm very confused right now. Please
go ahead and read the
logs here: http://pastie.org/1061905

Please let me know what you guys think on this issue.
Jul 27 2010
next sibling parent reply Sean Kelly <sean invisibleduck.org> writes:
Mengu Wrote:

 Hi all,
 
 I was reading an IRC server's codes which was C++ and thought how possible it
was with D and started a
 discussion in the #d room in freenode. Yet I'm very confused right now. Please
go ahead and read the
 logs here: http://pastie.org/1061905
 
 Please let me know what you guys think on this issue.
Looks like wm4 is saying that false references will kill any long-running app. That is, that because the GC is conservative it may treat some memory locations as pointers that really aren't pointers, which will in turn prevent the GC from collecting memory that has no actual references to it. Three thoughts: 1. There's a precise scanning patch in bugzilla right now. If applied, this should largely eliminate this issue. 2. This is only an issue for certain apps in the first place. Something like an IRC server isn't likely to encounter this problem given the sort of data it operates on. 3. A performance-minded server app isn't going to work the GC heavily anyway. In fact, with slices and such, D server apps of this sort don't have to use the GC at all once the initial startup routine has completed. In short, there's nothing preventing D from being a perfect language for this sort of work. Like anything else, what you get out of an app depends on the work you put into it.
Jul 27 2010
next sibling parent reply bearophile <bearophileHUGS lycos.com> writes:
Sean Kelly:
 1. There's a precise scanning patch in bugzilla right now.  If applied, this
should largely eliminate this issue.
But I/we don't know if or how well it works yet :-) Bye, bearophile
Jul 27 2010
parent Leandro Lucarella <luca llucax.com.ar> writes:
bearophile, el 27 de julio a las 12:45 me escribiste:
 Sean Kelly:
 1. There's a precise scanning patch in bugzilla right now.  If applied, this
should largely eliminate this issue.
But I/we don't know if or how well it works yet :-)
I did some testing, is not exhaustive at all, but it may give you some idea of what to expect. My conclusion is that this *first* approach is not as good as conservative scanning for some programs, but the (Tango) runtime patch is extremely simple and there are some optimization opportunities. All this keeping the current GC design, but the compiler patch open the possibilities of new designs that take better advantage of the type information. -- Leandro Lucarella (AKA luca) http://llucax.com.ar/ ---------------------------------------------------------------------- GPG Key: 5F5A8D05 (F8CD F9A7 BF00 5431 4145 104C 949E BFB6 5F5A 8D05) ---------------------------------------------------------------------- Does humor belong in music? -- Frank Zappa Yes it does, Frank. -- Kevin Johansen
Jul 27 2010
prev sibling parent Rory Mcguire <rjmcguire gm_no_ail.com> writes:
Sean Kelly wrote:

 Mengu Wrote:
 
 Hi all,
 
 I was reading an IRC server's codes which was C++ and thought how
 possible it was with D and started a discussion in the #d room in
 freenode. Yet I'm very confused right now. Please go ahead and read the
 logs here: http://pastie.org/1061905
 
 Please let me know what you guys think on this issue.
Looks like wm4 is saying that false references will kill any long-running app. That is, that because the GC is conservative it may treat some memory locations as pointers that really aren't pointers, which will in turn prevent the GC from collecting memory that has no actual references to it. Three thoughts: 1. There's a precise scanning patch in bugzilla right now. If applied, this should largely eliminate this issue. 2. This is only an issue for certain apps in the first place. Something like an IRC server isn't likely to encounter this problem given the sort of data it operates on.
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()); lazy helps when logging is off but only then. -Rory
Jul 27 2010
prev sibling parent 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