Slashdot Mirror


Java Gets New Garbage Collector, But Only If You Buy Support

An anonymous reader writes "The monetization of Java has begun. Sun released the Java 1.6.0_14 JDK and JRE today which include a cool new garbage collector called G1. There is just one catch. Even though it is included in the distribution, the release notes state 'Although G1 is available for use in this release, note that production use of G1 is only permitted where a Java support contract has been purchased.' So the Oracle touch is already taking effect. Will OpenJDK be doomed to a feature-castrated backwater while all the good stuff goes into the new Java SE for Business commercial version?"

31 of 587 comments (clear)

  1. Seriously Java? by jlechem · · Score: 5, Insightful

    You used to be cool.

    --
    Hold up, wait a minute, let me put some pimpin in it
    1. Re:Seriously Java? by __aaclcg7560 · · Score: 5, Funny

      Garbage in, garbage out.

    2. Re:Seriously Java? by JonTurner · · Score: 5, Funny

      Write once. Pay everywhere.

    3. Re:Seriously Java? by clarkkent09 · · Score: 5, Interesting

      As per release notes, this is an experimental feature. It may be that Sun intends to provide it only to paid customers or it may be that they want to make sure you don't use it in "production" environment until it's ready and then whine that Java is buggy if it doesn't work 100%.

      I don't know which is true but the second possibility seems far more likely to me, making this story completely pointless and unfair - but hey this is slashdot.

      Btw, off topic but is it just me or the subjects in replies are showing up as white text on white bg in Firefox but look ok in IE. I even tried in on another pc and same thing.

      --
      Negative moral value of force outweighs the positive value of good intentions.
    4. Re:Seriously Java? by maxume · · Score: 5, Informative

      Java and Javascript are only nearly identical in that they both contain Java in their names.

      Javascript is much closer to Ruby than it is Java (but the built in objects aren't generally as rich, and people scream and whine about the prototype based object system).

      --
      Nerd rage is the funniest rage.
    5. Re:Seriously Java? by Anonymous Coward · · Score: 5, Funny

      Huh? How are Java and Javascript nearly identical?

      They were both slow when they came out, they're both slow now, and they both have a bunch of people saying "oh, but it's faster now!"

    6. Re:Seriously Java? by shutdown+-p+now · · Score: 5, Insightful

      So long as they publish the spec, we can't accuse them of being proprietary.

      Yeah, just like .NET, right?

    7. Re:Seriously Java? by dedazo · · Score: 5, Interesting

      I don't know about Java, but I've been playing with Google's V8 and that sucker is fast, at least on Windows.

      --
      Web2.0: I love when people Flickr my cuil and digg my boingboing until my google is reddit and I start to yahoo
    8. Re:Seriously Java? by SplashMyBandit · · Score: 5, Informative

      You're a funny guy but obviously have zero idea about what you are talking about. It's a bit aggravating that ignorant folk still come out with the same old 'slow' mantra and unfortunately even more ignorant folk buy into it. That keeps people writing crappy software on C++ or C when quite often Java would be a good fit for them and the performance is mostly a non-issue these days (unless you write very inefficient programs).

      I used to eschew Java for the speed of C++ but now I've completely switched to Java for most development tasks (apart from some C glue-code [JNI] when I need to integrate some scientific instrument or another). I'm doing instrument control, image processing and analysis and I need both reasonable latency, multithreading support, and every performance cycle I can get, and yet Java is plenty fast enough for me (and even embedded devices these days have relatively large amounts of RAM this is far less of an issue than it used to be).

      Seriously Java is very fast these days. Graphics2D is all done in Direct3D or OpenGL shaders, the VM is very optimised and quite often approaches FORTRAN (which is faster than C). Don't believe me? check out the links below.

      So please, next time stop with the FUD (that used to be marginally true 5 years ago) and start with an open mind.

      • From http://en.wikipedia.org/wiki/Java_performance#Use_for_High_Performance_Computing
        "However, High Performance Computing applications written in Java have recently won benchmark competitions. In 2008, Apache Hadoop, an open source High Performance Computing project written in Java was able to sort a terabyte of integers the fastest.[46]"
      • INRIA (French scientifc Institution) report on High Performance Computing with Java [Summary: Java approaching FORTRAN for speed, although some network intensive speed bumps still remaining]
        http://hal.inria.fr/inria-00312039/en
      • From http://blogs.sun.com/jag/entry/current_state_of_java_for
        Current State of Java for HPC

        At the last JavaOne I did a walk-on talk during the AMD keynote where I talked about how incredible HotSpot's performance had become - beating the best C compilers. I ended my talk with a joking comment that "the next target is Fortran". Afterwards, Denis Caromel of Inria came up to me and said "you're already there". He and some colleges had been working on some comparisons between Java and Fortran for HPC. Their final report Current State of Java for HPC has been made available as a Tech Report and makes pretty interesting reading. There are a lot of HPC micro benchmarks in it which look great. Thanks! Permalink Comments [3]
  2. In this day and age of "green" businesses... by thomasdz · · Score: 5, Funny

    Shouldn't we have "recycling collection" instead of "garbage collection"?
    C'mon guys all those big 1MB and 4MB malloc()s are being shipped over to third world countries to be disassembled into bits and bytes. We should be recycling things HERE.... not throwing them away for Java to come and pick up.

    --
    Karma: Excellent. 15 moderator points expire sometime.
  3. Troll? by iamhigh · · Score: 5, Funny

    If you post a troll comment to an article tagged troll, do you get insightful mods?

    In Soviet Russia, article trolls you!

    --
    No comprende? Let me type that a little slower for you...
  4. Re:Garbage collector? by gubers33 · · Score: 5, Informative

    Garbage collection is the process freeing objects that are no longer referenced by the program.

    --
    Just because you are wrong and I called you out on it doesn't mean I am a Troll.
  5. Perhaps by alexborges · · Score: 5, Interesting

    "Will OpenJDK be doomed to a feature-castrated backwater while all the good stuff goes into the new Java SE for Business commercial version?""

    Perhaps. But now that its GPL, maybe IBM, RH and the rest of Java's stakeholders will get onto making openjdk better than oracle's. Ill sure contribute: this is a strategic need for the foss movement.

    --
    NO SIG
  6. Re:Garbage collector? by HBI · · Score: 5, Informative

    Java hides the details of memory allocation from the programmer. Objects, strings, etc use memory. When they are first used, Java makes sure that the appropriate amounts of memory are allocated for the item in question. When these items are no longer in use, the garbage collector finds them and frees the memory so that it can be used for other parts of the application.

    VB is another place where a garbage collector would be found. Ditto .NET.

    --
    HBI's Law: Frequency of calling others Nazis is directly correlated with the likelihood of the accuser being Communist.
  7. It's "experimental" by ensignyu · · Score: 5, Insightful

    To try G1, specify these command line options:

    -XX:+UnlockExperimentalVMOptions -XX:+UseG1GC

    I don't see anything obvious preventing you from using it (no license/support keys?), it's just not recommended since it's experimental. If you're crazy enough to use it on a production server, you better have a support contract so Sun/Oracle can fix any problems that come along. That seems reasonable.

    Although it'd be better if they just said "don't use it for production, period."

  8. Pull your head out of your ass by Anonymous Coward · · Score: 5, Informative

    The G1 collector is still a "work in progress" so they are suggesting that you use it *in production* only if you have a support contract with Sun (Oracle?). This is not a big deal. You can still use it, just enable it with "-XX:+UnlockExperimentalVMOptions -XX:+UseG1GC" on the command line...

  9. Tony Soprano in charge by Alzheimers · · Score: 5, Funny

    Meet Vinny and Guido, my business associates in the waste management business.

    You see, it's like this. I gotta eat. My kids gotta eat. Vinny and Guido's families have to eat.

    We know where you live. It's a nice place, big houses, fancy cars. You can afford to eat, very well.

    You wouldn't your neighboorhood to fall victim to all sorts of garbage dumpers, would you? How about a recycling plant, right next to where you work?

    No? Well, I'm sure you'll understand when I say that it is in your best interest to respect our business model. Or else, Vinny and Guido might have to go hungry for a bit. And I assure you, they get very unfriendly when they get hungry.

    Capiche?

    1. Re:Tony Soprano in charge by frank_adrian314159 · · Score: 5, Funny

      That's a real nice production server you got here. It'd be a shame to see something unfortunate happen to it. I mean a server room's a dangerous place, ain' it? You got cables and electricity around and, well... accidents happen, if you know what I mean.

      Especially with garbage lyin' around all over your memory. Pipes could get clogged, tables could fill up, processes could meet an untimely demise... you know what I'm talking about.

      Now for a very reasonable fee, we can see that your garbage is collected regularly. It's a very small fee, once you think about what could happen if you didn't have folks like us around to help you. We'll see that this very nice production server continues to run in tip-top shape. Yes, our small garbage collection fee could help you avoid all sorts of unpleasantness...

      --
      That is all.
  10. It's still experimental by MrEricSir · · Score: 5, Interesting

    Methinks they just want to make damn sure nobody uses this feature in a production environment. This is more of a sneak peek for paying customers who are contractually bound against using this in a production environment.

    If this was included in the standard distribution, then people would use it no matter what the documentation said. And then Sun would be saddled with bug reports and whining.

    --
    There's no -1 for "I don't get it."
  11. G1 is already in OpenJDK by TeaCurran · · Score: 5, Informative

    G1 is in the latest OpenJDK builds. Since it is GPL you are free to use it without any license restrictions.

    The note in the release notes is only saying that Sun won't officially support it in their releases without a support contract.

    If you are concerned, use OpenJDK.

  12. Re:Forgive my ignorance WAS:re: Garbage collector? by publiclurker · · Score: 5, Informative

    While in theory, avoiding memory leaks is easy, in practice, it is rather difficult for anything but the most trivial programs. that's one of the reasons why garbage collection was created in the first place.

  13. Reference Counting != Garbage Collection by samweber · · Score: 5, Informative

    No, no, no! Creating a cycle of object references does not cause a memory leak in Java!

    You are assuming that a garbage collector uses reference counting. However, reference counting doesn't work for the very reason you state, and therefore GCs don't do it that way. They actually check whether an object is usable by the program, and not just whether it has any old reference to it.

  14. Re:Forgive my ignorance WAS:re: Garbage collector? by hibiki_r · · Score: 5, Informative

    Even in modern C++, memory allocation and destruction is commonly done behind the scenes using reference counting pointers.

    Whenever you are dealing with anything that resembles a complex data structure, making sure that the programmer has to think very little about memory allocation is a huge boon. Programmer productivity across the alst 50 years hasn't changed much, if we look at statements written per month. The main difference is that 50 years ago, our statements did a lot less than they do now. A programmer that doesn't have to think of memory requirements can spend more time thinking about the actual business requirements, and improving the core algorithms.

    Leaving the memory management to a library is also a good way of minimizing the damage that a careless programmer can make. I remember the cost of a bad programmer in a team coding in C: It'd take longer to track his memory leaks, pointer overlaps buffer overruns than it would have taken the more reliable programmers to write the code from scratch. In languages like Java and C#, one has to really be working hard to be a true liability. There's just a lower barrier of entry. In a world that's not filled with uberprogrammers, but barely competent ones, this is a huge boon.

    And that's why few shops making business software would even dare to start a new project in a language without garbage collection: Unless you have quite a special team, a great QA process and are memory constrained, you'll be more productive in a language that is further away from the metal.

  15. G1 is for the Entreprise by jeanph01 · · Score: 5, Informative

    Here [http://developers.sun.com/learning/javaoneonline/j1sessn.jsp?sessn=TS-5419&yr=2008&track=javase] what sun says about it : The Garbage-First garbage collector (G1 for short) is the next-generation low-pause garbage collector that will be included in the Java HotSpot virtual machine. G1 will be the long-term replacement for the Concurrent Mark-Sweep (or CMS) garbage collector, Sun's current low-pause garbage collector. G1 targets medium to large multiprocessor machines and large heaps, relying heavily on the concurrency and parallelism such machines offer. Like CMS, G1 is generational, which benefits throughput. Unlike CMS, G1 compacts to battle fragmentation and to achieve more-consistent long-term operation. As its name suggests, G1 concentrates its collection and compaction activity first on the areas of the heap that are likely to be full of reclaimable objects, thus improving its efficiency. G1 uses a pause prediction model to meet user-defined pause time targets. It achieves smoother pause times than CMS, with fewer or no outliers at comparable or better throughput, as this presentation shows. The initial target pause times are in the low tens of milliseconds. === So this is more for entreprise multiprocessors, multiservers java. And those entreprise normally will buy a support contract. So it's almost a no news.

  16. Re:Forgive my ignorance WAS:re: Garbage collector? by Thomasje · · Score: 5, Insightful
    The reason why Java has garbage collection has nothing to do with programmer convenience; it is needed in order to make Java's security model work. Without garbage collection, a thread could allocate a chunk of memory and then free it, while hanging on to the pointer -- and then periodically take a look at what shows up in the memory area where the previously freed block used to be. Any Java process running in the same VM would be at risk. This kind of deliberate use of "dangling pointers" is easy to prevent if using garbage collectors, very difficult to prevent otherwise.

    Protecting processes running in the same VM from each other may not seem terribly useful now, but Java was originally designed to be used in embedded controllers, where the JVM would *be* the operating system, and where processes had to be protected from each other without the help of a hardware memory management unit.

    FWIW, I also beg to differ about the difficulty of manual memory management. In C++ it is usually very easy, as long as you're consistent about doing deallocations in destructors. I once had to write a 40,000+ line C++ program, with lots of dynamic memory management going on; once development was complete, I ran a complete test suite under Purify, and found 5, yes, five, memory leaks. Considering that most leaks are the result of mis-handled object ownership, which is an issue that garbage collection does not eliminate in general, you should be careful about your design, *and* use memory analyzers like OptimizeIt, even when developing in a GC environment.

  17. Re:Garbage collector? by nog_lorp · · Score: 5, Insightful

    Substitute "objects" with "memory" and "referenced" with "used", and you might actually reach the intended audience (people who aren't programmers).

  18. Re:Forgive my ignorance WAS:re: Garbage collector? by Red+Flayer · · Score: 5, Funny

    I ran a complete test suite under Purify, and found 5, yes, five, memory leaks

    Five memory leaks!
    Ah-ah-ah.

    One... two... three... four... five memory leaks!

    Ah-ah-ah.

    Sorry. I have a toddler at home. I couldn't help counting out loud in a silly voice when you mentioned the number 'five' twice.
    br.Now my coworkers are eyeing me even more strangely than usual.

    --
    "Trolls they were, but filled with the evil will of their master: a fell race..." -- J.R.R. Tolkien on Olog-hai
  19. It's in OpenJDK too by arthurp · · Score: 5, Informative

    G1 is in OpenJDK and JDK7 as well as the new JDK6. So it's open source. So fear not. I think that as people have mentioned below they are simply trying to protect themselves from people turning on this feature in a production environment and then bitching to them about it.

  20. Re:No malloc( )s by TimeTraveler1884 · · Score: 5, Funny

    Holy crap! That joke cut his head off!

  21. Re:Garbage collector? by jeremyp · · Score: 5, Informative

    As a beer drinker, I drink lots of beer. When I was a C++ programmer, I had to make sure I threw away my empty beer cans after drinking the beer. Unfortunately, occasionally, I forgot to do that and pretty soon my room would fill up with empty beer cans so that I couldn't get to the fridge to get more beer out of it.

    However, now I am a Java programmer and I have a servant (a beer can collector) who comes around and clears up the beer cans for me every now and again. I no longer have to worry about throwing them away myself.

    --
    All I want is a secure system where it's easy to do anything I want. Is that too much to ask ~~ Randall Munroe
  22. Re:Forgive my ignorance WAS:re: Garbage collector? by idontgno · · Score: 5, Funny

    In C++, there are better ways to prevent memory leaks than carefully freeing everything in your destructors (which doesn't work anyhow if your constructor throws an an awkward moment).

    You accidentally a few words. You might say you accidentally a grammar exception at an awkward moment.

    --
    Welcome to the Panopticon. Used to be a prison, now it's your home.