Forgot your password?
typodupeerror
Java Programming

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

Posted by ScuttleMonkey
from the putting-on-the-squeeze dept.
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?"
This discussion has been archived. No new comments can be posted.

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

Comments Filter:
  • Seriously Java? (Score:5, Insightful)

    by jlechem (613317) on Friday May 29, 2009 @03:02PM (#28142063) Homepage Journal
    You used to be cool.
  • by SurfMan (969573) on Friday May 29, 2009 @03:02PM (#28142075)
    With the JavaOne starting this week, it might be a nice opening question on day one... "What the hell are you thinking, mister Schwartz??"
  • We buy... (Score:1, Insightful)

    by Anonymous Coward on Friday May 29, 2009 @03:05PM (#28142103)
    We buy garbage, instead of the real product these days? :)
  • by ensignyu (417022) on Friday May 29, 2009 @03:10PM (#28142193)

    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."

  • Re:Seriously Java? (Score:2, Insightful)

    by Anonymous Coward on Friday May 29, 2009 @03:10PM (#28142203)
    Too cool for its customers.
  • Re:Seriously Java? (Score:5, Insightful)

    by Lord Ender (156273) on Friday May 29, 2009 @03:11PM (#28142217) Homepage

    So long as they publish the spec, we can't accuse them of being proprietary. So long as the free version is superior to other similar free technologies, they will still be the market leader. Sounds like they know what they're doing.

  • Prediction (Score:2, Insightful)

    by system1111 (1527561) on Friday May 29, 2009 @03:13PM (#28142249)
    Put a fork() in her she's done!
  • by dazedNconfuzed (154242) on Friday May 29, 2009 @03:15PM (#28142289)

    The ongoing problem with FOSS is that hard, un-cool, gritty, vital work ultimately takes money to do right. Cool gets projects only so far; money is needed for viable completion.

  • Re:No malloc( )s (Score:1, Insightful)

    by Anonymous Coward on Friday May 29, 2009 @03:15PM (#28142291)
    WHOOOOSH
  • Re:suprised???? (Score:3, Insightful)

    by KerberosKing (801657) on Friday May 29, 2009 @03:28PM (#28142505)

    did anyone really think Oracle was going to continue to release fully featured JDKs for free?????.....this is why the day Oracle bought Sun, i started learning C#....

    lol, yes because C# is owned by a much more FOSS-friendly company. Microsoft would never charge to support experimental features in production-code.

  • by deraj123 (1225722) on Friday May 29, 2009 @03:31PM (#28142551)

    I don't know...the release notes specifically say:

    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.

    On the other hand, I was unable to find any specific mention of G1 anywhere in the licensing agreement. However, I did find this:

    Sun grants you a non-exclusive, non-transferable, limited license without license fees to reproduce and use internally Software complete and unmodified for the sole purpose of running Programs.

    If anyone is able to point out in the actual licensing where the quote from the release notes is backed up, I'd be interested. (text near the second quote there did allow for "exceptions" and "supplemental terms" - but I wasn't able to find any pertaining to G1)

  • by geekboy642 (799087) on Friday May 29, 2009 @03:36PM (#28142627) Journal

    It would not be more robust.
    The more things you have to pay attention to at the nuts-and-bolts level, the fewer things you are able to pay attention to at the business logic level. The key difference between managed languages like Java and non-managed languages like C, is that the uninteresting grunt work is done for you by the compiler. A vast majority of security flaws are related to programmers thinking exactly like you do. Even if the programmer is very highly skilled, memory management is tedious and difficult, and it is impossible to never make a mistake. Mistakes in memory management lead to segfaults or remote exploits.
    Non-managed languages should be used only when the performance benefits outweigh the dangers.

  • by Sangbin (743373) on Friday May 29, 2009 @03:43PM (#28142727)
    Developers may search for JRE on Android...which is also called G1.

    Do you really want mixed results on Google search for "G1 Java"?
  • by Thomasje (709120) on Friday May 29, 2009 @03:49PM (#28142801)
    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.

  • by vux984 (928602) on Friday May 29, 2009 @03:52PM (#28142859)

    would think it would be a lot more robust to keep track of allocation and deallocation explicitly, add when you need, and delete when you don't need, and not count on some generic mechanism.

    Ok... so I allocate object A. Then I allocate object B, C, and D that all reference A but aren't aware of eachother. Then I release D, and don't know whether to release A, so now A needs to have some sort of reference counting mechanism, and I have to remember to use it each time I create or copy or pass a reference to A.

    Or... I can use a language that implements the reference counting stuff for me and implicitly calls it when I allocate new objects, create, copy, or pass references, and expire them as they go out of scope, without me having to write explicit destructors.

    Basically, if you do any sort of remotely complicated object allocation where you are going to need to implement reference counting to keep track of them, you might as well use a garbage collector. That's what it does, it comes thoroughly debugged, and you don't have to waste time implementing and debugging your own.

    So, a garbage collector language is MORE robust (assuming robust means 'more reliable').

    That's not to say unmanaged code doesn't have its place, but in my experience managed code tends to get developed faster and cheaper than equivalent unmanaged code, so it only makes sense to use unmanaged code where you really need the performance or nuts&bolts control. Your typical productivity or business logic application don't. Drivers, real-time systems, etc do.

    As always, use the best tool for the job. C is not always the best tool.

  • Re:Seriously Java? (Score:3, Insightful)

    by binarylarry (1338699) on Friday May 29, 2009 @03:54PM (#28142887)

    Right, Java wasn't ever cool, which is why every major software company seems to be scrambling to make their own Java style platform (.NET, the new Flash stuff, etc).

  • by COBOL/MVS (196516) <argherna.hotmail@com> on Friday May 29, 2009 @03:55PM (#28142899) Homepage Journal

    But that's the kind of stupid shit that's been spewing from here for the last 10 years.

    PS - the look and feel of slashdot sucks

  • Re:Seriously Java? (Score:5, Insightful)

    by 1729 (581437) <slashdot1729.gmail@com> on Friday May 29, 2009 @03:58PM (#28142939)

    You could also dispense with having to maintain two nearly-identical languages (Java and Javascript)

    Huh? How are Java and Javascript nearly identical?

  • by Anonymous Coward on Friday May 29, 2009 @04:02PM (#28142983)

    The price is also that it is far less agile. Want to make a change? Make sure someone goes over it with a fine toothed comb. While that might sound appealing to the "experts" a lot of people just want to get the job done and move on to more exciting tasks.

  • Even when... (Score:3, Insightful)

    by jd (1658) <imipak&yahoo,com> on Friday May 29, 2009 @04:02PM (#28142989) Homepage Journal

    ...you have explicit allocation/deallocation, you get holes in memory. There's no way to avoid it, for the same reason that fragmentation occurs on disks. Unless the chunk you allocate is exactly the same size as the chunk last deallocated, there will be a region of memory that cannot be used.

    This means that your heap will end up looking like swiss-cheese, unless you have some means of shuffling things around. Unless the programmer can absolutely guarantee that mallocs and frees only occur in such a way that no space unusable to the program's next malloc is ever left, the program will always have the potential of exhausting resources even without leaking memory.

    This is why there are all kinds of malloc() substitutes for C, including several with garbage collection. If the program runs for long enough, the vanilla malloc() in most C libraries is simply not good enough.

  • JRE (Score:1, Insightful)

    by Anonymous Coward on Friday May 29, 2009 @04:05PM (#28143017)

    So, not only is it slow to start up, requires a lifetime of XML Hell, and bowing down to the architecture astronauts (remember kids -- it is not a good java program unless you can spot three design patterns for every 15 lines of code!), now they are going to make you pay for the remaining bits to work?

    I am glad I stuck with C++.

  • by nog_lorp (896553) on Friday May 29, 2009 @04:05PM (#28143033)

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

  • by mario_grgic (515333) on Friday May 29, 2009 @04:13PM (#28143157)

    Nice, now try couple of million lines of code, maintained by 50 or so developers of various levels of experience and see how many memory leaks there are then.

  • Re:Seriously Java? (Score:5, Insightful)

    by shutdown -p now (807394) on Friday May 29, 2009 @04:17PM (#28143189) Journal

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

    Yeah, just like .NET, right?

  • Re:Seriously Java? (Score:3, Insightful)

    by Zardoz44 (687730) on Friday May 29, 2009 @04:31PM (#28143349) Homepage

    Please provide me one example of a free/OSS platform implementation of a commercial product that is inarguable BETTER than the original proprietary version

    Linux > Unix.

    Git > Sourcesafe.

  • Re:Seriously Java? (Score:5, Insightful)

    by moonbender (547943) <moonbender@NospaM.gmail.com> on Friday May 29, 2009 @04:50PM (#28143615)

    Great, Ruby will fit right in.

  • Re:Seriously Java? (Score:3, Insightful)

    by shutdown -p now (807394) on Friday May 29, 2009 @05:02PM (#28143807) Journal

    Making it technically opt-out if you're a developer. But no normal user will figure out that they need to disable it in the first place, let alone how to disable it.

    A "normal user" rarely starts a Java application by double-clicking a .jar - instead, he'll usually use the developer-provided .exe wrapper which will start up the JVM properly configured (and to which the installer for the application will create a shortcut in Start Menu and/or on the desktop). That wrapper can set properties the way developer wants, including this particular one.

    On a Unix system, the wrapper will most likely be a shell script instead, in which case - as another AC has posted already - it'd just use -D, as with any other property:

    java -Ddeployment.security.blacklist.check=false -jar foo.jar

  • Re:Seriously Java? (Score:3, Insightful)

    by flydpnkrtn (114575) on Friday May 29, 2009 @05:12PM (#28143951)

    Hah whoops please `sed s/EMACS/ECMA/` in that last post... everyone knows EMACS has its own scripting language (it is an operating system, after all)

  • Re:Seriously Java? (Score:3, Insightful)

    by Anonymous Coward on Friday May 29, 2009 @05:56PM (#28144479)

    Java "stopped being cool" when your average C/C++ alleged hotshot realised other developers who were not as good at fancy pointer tricks but better at CS could get 10 times the performance within the same deadline by focusing on algorithms instead of fixing memory leaks.

  • Re:Seriously Java? (Score:5, Insightful)

    by amRadioHed (463061) on Friday May 29, 2009 @06:10PM (#28144647)

    Linux is better than some Unix's in some circumstances. It is not however an inarguable matter of fact. ZFS is just one possible example where an argument could be made that Solaris is better.

  • Re:Seriously Java? (Score:2, Insightful)

    by MikaelC (584630) on Friday May 29, 2009 @06:18PM (#28144721)
    Firefox > Internet Explorer
  • Re:Seriously Java? (Score:4, Insightful)

    by nanoflower (1077145) on Friday May 29, 2009 @06:22PM (#28144769)
    Could you please provide me with examples of why Linux is better than Unix? Keep in mind that there are many varieties of Unix ranging from the paid kind to the free kind and that most of what people like to think of as Linux isn't really part of the OS but just open sourced programs that will run on many systems including those based on Unix. I'm not saying that Linux is bad, just that it seems difficult to really say one is better than the other since they are so intertwined.
  • Re:Seriously Java? (Score:2, Insightful)

    by GigsVT (208848) on Friday May 29, 2009 @07:30PM (#28145405) Journal

    Yeah, in some fantasy world where Java programs just work.

    More realistic is that you get some mess of stuff with nothing obviously executable, and then once you figure out what thing you are supposed to run, it complains about something called a CLASSPATH and refuses to run.

  • Re:Seriously Java? (Score:5, Insightful)

    by jlarocco (851450) on Friday May 29, 2009 @08:47PM (#28145989) Homepage

    I don't buy it.

    The first clue is that the speed of the C++ version doesn't match the C version. Of course there's a difference between "good C++" and "good C", but if your goal is speed then you're not typically concerned about those differences.

    Second, reading through the scienceblog.com article, the author calls the (unavailable) code "carefully optimized," yet he claims the C code is slower than the others because of pointer aliasing. However, any modern C compiler has pragmas and compiler optimization flags that tell it to assume no aliasing occurs. How carefully could he have optimized the code if he didn't even bother turning on compiler optimizations?

    I don't think the scienceblogs guy really knows enough about C and C++ to back up his claim.

  • Irrelevant (Score:4, Insightful)

    by hackus (159037) on Friday May 29, 2009 @08:56PM (#28146049) Homepage

    The entire Java Stack has long since been opened up. The community essentially owns it now. What Oracle does with "Java" I could care less.

    Anything that is worth while to build design and construct/maintain Java applications and VM's is all open source.

    If they want to fork and become irrelevant that is there choice.

    -Hack

  • Re:Seriously Java? (Score:1, Insightful)

    by Anonymous Coward on Friday May 29, 2009 @09:03PM (#28146085)

    "write once, run anywhere"

    Bwahahaha! Biggest Java lie ever.

    "Always backwards compatible"

    HAHAHA! Again more java lies.

  • Re:Seriously Java? (Score:1, Insightful)

    by Anonymous Coward on Friday May 29, 2009 @09:19PM (#28146153)

        How is Linux better than Solaris or AIX at the workloads they are typically assigned ?
        More ubiquitous but demonstratively better at what? Large, heavyweight workloads?

  • Linux UNIX (Score:4, Insightful)

    by jimfrost (58153) * <jimf@frostbytes.com> on Saturday May 30, 2009 @03:20AM (#28147735) Homepage
    Linux > Unix.

    Other than cost, I'm curious as to what you are measuring.

    It's not performance. Solaris 10 on a PC outperforms Linux when stressed, sometimes by huge margins. It's not a complete blow-out with modern kernels, like it was in the 2.4 days, but it's still significant -- and there are corners where it really still is a complete blow-out (like: What does fsync() do?).

    It's not stability. Again, Solaris 10 is much less likely to crash or go all wonky when stressed, and AIX is similarly robust. And again there are corners here that can have large impact on reliability of applications (e.g. I recall some annoyances with direct io, although the specifics are escaping me at 3am).

    It's not core features, by and large Linux lags the commercial UNIXen in that arena (e.g. Dtrace), which isn't really surprising since Linux is effectively a clone.

    Having said that, there are certainly UNIXen that do not stand up so well to Linux (*cough* HP/UX *cough*), but there certainly exist UNIXen that are generally superior.

    Of course, a lot depends on what you're doing with the system. If I need to push the system as hard as possible then I want Solaris if it is an option. If I am looking for general usability I find Linux preferable. The differences in the latter case are often minor (like the -c argument to "script") but taken en-masse they make for a more pleasant experience.

    That's the way I see things today. I am not at all sure we won't see Linux pull into the lead over time -- it is getting better and better with age, and most UNIX systems appear to be seeing improvement stagnation. (And that may well be universal soon: What are the odds that Solaris doesn't see its R&D budget chopped under Oracle?) In summary I would generally prefer to do development on Linux, but want production on Solaris. Best of both worlds, at least today. It may be telling, though, that on my personal server systems I run Linux even when I am concerned about performance -- the ongoing administration is significantly easier it you pick the right Linux distribution, and it isn't picky about hardware like Solaris is, and the tool suite is free as in beer without any extra effort.

    Except on the desktop. There MacOS is supreme IMO. All the goodness of UNIX, plus stellar UI and commercial applications. I dunno how it does in stress situations (almost nobody buys Apple servers) but it's a great desktop system.

  • Re:Seriously Java? (Score:4, Insightful)

    by jgrahn (181062) on Saturday May 30, 2009 @03:41AM (#28147833)
    Grandparent: "using std::vector::at and std::iterator to access it in c++, then c++ would be significantly slower"

    Oh, I know - and I can think of a dozen similar ways to make the C++ version slower than the C version. But nobody with any sense would do that if they were trying to speed up the code as much as possible.

    If you're thinking of vector::at() you're possibly right. But a vector::iterator doesn't have to be slower than a pointer, and avoiding it for fear of speed issues would be stupid. I can imagine some C++-y things being slower (std::copy compared to memcpy, in some situations) but not simple iterators.

    In fact, when I ran the code below across a 200,000 element array/vector, the std::vector version was 10% faster. (Note that I didn't benchmark array indexing; I am so used to iterators that [begin, end) is the style which feels natural to me even when I use raw pointers.)

    int bencharray(int * const a, int * const b)
    {
    int val;
    for(int i = 0; i < 50000; ++i) {
    int * p = a;
    val = random();
    while(p!=b) {
    *p++ = val++;
    }
    }
    return val;
    }

    int bench(std::vector<int>& v)
    {
    const std::vector<int>::iterator a = v.begin();
    const std::vector<int>::iterator b = v.end();

    int val;
    for(int i = 0; i < 50000; ++i) {
    val = random();
    std::vector<int>::iterator p = a;
    while(p!=b) {
    *p++ = val++;
    }
    }
    return val;
    }

    So I still don't understand how that benchmarking guy (who knew C++ well!) managed to make it three times slower than C. We should probably ignore his results altogether, since his source code is lost.

  • Re:Linux UNIX (Score:3, Insightful)

    by turgid (580780) on Saturday May 30, 2009 @05:06AM (#28148101) Journal

    Solaris is a specific case of original, commercial unix which went open source a few years ago.

    Back in the '90s, when Linux distributions started to get really popular, the Linux kernel and the distributions overtook many of the old commercial unices (e.g. SCO Unix, AIX, IRIX...) and effectively killed them.

    Linux was cheaper (free), the user-land was more user-friendly (GNU tools, GNOME, KDE...), and truly cross-platform.

    Linux's and GNU's openness and freedom was and is the key to its success. There are now millions of people around the world proficient in Linux/Unix who wouldn't have been for this very reason. There are people like me who made it all the way to being a Software Engineer simply by having a Linux system in the home to learn on.

    Solaris is still ahead by a long way on high-end technical features like ZFS and is quite possibly the only commercial unix that has a future now.

    I have 3 Solaris 11 UltraSPARC boxes in my house just now: a SunBlade 100 and two Ultra 80s (4 CPU).

For every bloke who makes his mark, there's half a dozen waiting to rub it out. -- Andy Capp

Working...