Fab wrote:
Hi !
Maybe somebody has used a GC - I think to Hans Boehm's one, but
other, if any, are welcome -. I need to use a GC in order to program an
interpreter for a functional language. Memory handling would be
otherwise difficult too much. I read that the use of Boehms'GC - well
fit for C - was generally complicated enough and particularly for STL.
I confess I considered to switch to Java for this reason...
But what about SGI hash extension in Java ? What about Boost Spirit or
Graph library ? I don't know. Maybe Java does not provide such packages
?
However I prefer to stay in C++ world :
- save learning time
- produce speed code, using powerful STL and Boost
Please do you have simple examples of GC use :
- in any C++ program,
- in a STL program.
Thanks
Fabrice
I respectfully beleive that memory handling is easier without a GC,
since many of these fail to function properly anyways and have a
considerable impact on performance, not to mention the critical issue
of accountability - which is the key here. The best GC is you, a smart
pointer or better yet, no pointers at all.
I can understand in C where references don't exist, but not in C++.
Allocation == ownership, thats the law. In fact, C++ has a term for it:
RAII
http://en.wikipedia.org/wiki/Resourc...Initialization
Incidentally, without denigrating Java's reason to be, it would be a
much better language if it did not have the need for a GC. This is
specially relevent since a Java reference is a dumb raw pointer. If
Java implemented its references as smart references based on scope, not
just use, i'm convince without a doubt that Java would run faster, gain
in stability, and be the premium language in use today.
Only an opinion and not neccessarily the correct one.
My big pet peeve with Java is that most example codes and tutorials
teach Java programmers to regenerate Objects instead of reusing them.
Why? Cause the garbage collector takes away the a programmer's
responsability_ to_manage his code's resources. Thats a shame,
specially __with__ a GC!!