Berkeley CSUA MOTD:Entry 17337
Berkeley CSUA MOTD
 
WIKI | FAQ | Tech FAQ
http://csua.com/feed/
2024/12/25 [General] UID:1000 Activity:popular
12/25   

2000/1/26-27 [Computer/SW/Languages/Perl] UID:17337 Activity:very high
1/26    Some friends of mine are having problems with memory
        management in Java.  Is there a way you can force
        garbage collection in Java?  Alternatively, is their
        a way you can do memory allocation similiar to C/C++
        where you can explictly allocate and deallocate stuff
        so that you aren't at the mercy of the garbage collector?
         \_ java 1.1: System.gc(); System.runFinalization;
                in that order, to force garbage collection and
                call all object finalize() methods.
         \_ Does that actually FORCE garbage collection, or does
            the system just treat it as a suggestion?  Thanks.
            \_ depends on the java VM.  The ones I've worked with
               actaully do a GC when you ask for one, but this
               is not required by the language spec. - seidl
         \_ Are you sure the problems are caused because the VM isn't
            doing a gc? You could have objects which you think are dead,
            but are still referenced and therefore not up for GC. You'll
            need to use some tools to figure out.
            Also, the VM you are using is important. Some Java VMs out there
            use conservative gc, in fact I think all the Sun VMs before
            HotSpot (which has an exact garbage collector) used conservative
            gc. With conservative gc's, it's possible to have objects which
            are collectable, but the garbage collector isn't *sure* they are
            collectable, so to be safe it doesn't collect them (this can not
            happen with an exact collector).
            \_ Dude, if garbage collection is so complicated and delicate,
               what the heck is the point?  If I'm going to worry about
               memory management with GC, why not just use new and delete?
               New and delete are nice and simple and you don't have to
               worry about all this weirdness;  you just clean up after
               after yourself.
               \_ Implementation of GC is complicated and delicate, but
                  the use of a GC'd runtime system isn't. Or at least,
                  it shouldn't be -- the problem here is that the people
                  who originally designed an implemented Java are morons
                  (if you need any more proof, look at java.util.Date).
                  When using any reasonable garbage collector (like one
                  in any Smalltalk or the Java HotSpot), you just make new
                  objects and the garbage collector will reclaim when they
                  can no longer be used.
                  Now, you could make a programming error where something
                  you think should no longer be useable still is, but
                  if you have good programming habits, that shouldn't happen
                  very often. Far less often than memory leaks with malloc,
                  free.
         \_ Also, if you set the variables' value to null I believe it will
            be marked for garbage collection.  Of course, this won't _force_
            gc.
            \_  This is a myth -- nulling vars does not help gc. Either
                you need
                the objects in those vars, in which case they should not be
                up for gc and they should not be null (of course); or you
                don't need them and you don't need the class holding on to
                those variables, so the root class should be up for gc and
                its ivars should be up for gc also.
                I guess the above is not true if you have a class that is
                long lived but puts objects that it only needs for a short
                time into an variables, but that *probably* is a bad design.
        \_ Perl has great GC mechanism, is easier to program (little error
                                \_ No.  The way you wrote it, either meaning
                                   was valid in English.  See you at the end
                                   of English 1A.  Do not pass Go.
           catching code required), is portable, and has BETTER GUI designer
           (Perl/Tk). It is also OO (Perl5). GO PERL!
                                  \_ Perl OO is about as intuitive as IRS tax
                                     forms.  It is incredibly awkward as well.
                                        \_ Perl is easy for people with a unix
                                           background.  We're the target
                                           audience.  Sorry if that's not you.
              What an insightful comment.  Where did I say that I don't _/
              have a unix background?  I didn't?  Then why did you make such an
              inane statement?  Look again:  Perl is a great language for many
              things, but it's impl of OO sucks.
                \_ Thought you were talking about Perl as a whole, not Perl OO
                   in the second line.
                   \_ Please pay attention.  Thank you for playing.
                      \_ No.  The way you wrote it, either meaning was valid in
                         English.  See you at the end of English 1A.  Do not
                         pass Go.
                         \_ Bzzz! Try again.  'It' refers to 'Perl OO' not to
                            Perl.
                            \_ Duh.  That was obviously your intended meaning
                               looking back with your able assistance to parse
                               your questionable grammar, but it is not the
                               only valid interpretation of what you said.  You
                               are a dunce and a nincompoop.  You're not quite
                               at the self-centered low-grade moron level but
                               keep trying and you'll make it soon enough.
                               \_ What part of "It...as well" doesn't
                                  obviously refer to Perl OO.
                                  \_ "It" can refer to either Perl or Perl OO
                                     as used.  Consult HS English teacher.
                                     \_ "My car door is poorly implemented.  It
                                        is awkward to use as well."  Do you
                                        honestly mean that I could be talking
                                        about the car or the car door?  Moron.
                                        \_ Geeks arguing about grammar arcana
                                           are always so *cute* . . . I just
                                           want to reach out and give the both
                                           of you one great big *hug*!
                                        \_ thread snipped. here you go:
                                           alt.usage.english
           \_ Perl GC doesn't catch circular structures because it uses
              reference count GC.
           \_ LISP! LISP! LISP IS THE STANDARD!  Garbage collection language.
        \_ PERL IS THE BEST, JAVA SUCKS!!!!!                    -sys adm
           \_ JAVA IS THE BEST, PERL SUCKS!!!!!                   -god
              \_ I don't think god reads the motd.
                 \_ *pshaw* Since when did you have to read the motd to
                    post to it?