|
Re: How do you choose your programming language ?: msg#00085culture.hackers.israel
On Wed, Nov 23, 2005, Tzahi Fadida wrote about "RE: [hackers-il] How do you choose your programming language ?": > I am not sure you are correct. I believe that in latest java there is a trick > with > the classloader that you can allocate and free objects, however I heard > that it can lead to memory leak (whats new). Any language is Turing-complete, and if you realy try very hard, you CAN allocate and free memory, perhaps by using class-loaders, or perhaps by using JNI (i.e., C code). But doing this is extremely complex, and goes against the entire design of the language. It's almost like buying a plane, and then taking off its wings and trying to modify its engine to be more fuel-efficient - why don't you buy a car instead? Nobody programs the way you describe in Java, except perhaps as an excercise. If someone wants to write this way, they just switch to C or whatever. > I also heard that there are alternative > GC and that there are calls that can expedite GC. For the object creation patterns that are common in Java (myriads of short- lived objects, Java's current GC ("hotspot") is extremely efficient in speed, because allocations are extremely quick (no need to "search the heap" for holes like in C, just increment the pointer), even in a multi-threaded program, and free doesn't take any time (the time of GC is not proportional to the number of dead objects, but rather to the number of living objects). I wonder, though, if anybody attempted to do a reference-counting GC for Java (do you know of such a thing?). It would have been much slower than the current GC, but perhaps waste much less memory. For many applications, this could have been a win. > Anyway, as I mentioned before there are native compilers that makes all these > a mute discussion, e.g. GCJ. And, its FOSS. I completely fail to understand this statement. Please enlighten me. Even if gcj compiles codes, it still has to use garbage collection, because in Java all parameters are "passed by reference" (except for primitive types like "int"), and anybody can save these references and use them later, and stop using them much later. Except a few optimizations (like immediately freeing an object which was never passed anywhere), I don't see what you can do to improve memory waste by dead objects. And these optimizations are not specific to a compiler, anyway. > Personally the most important reason I like JAVA is that you can find the > bugs quickly > and develop quickly using Jbuilder which is the best (although you have to > pay). I use eclipse, which is probably the most convenient development environment I've seen. I agree, it's much more fun to program in Java than in C or C++. BUT, the sad truth is that often when you finish the project and see how the result behaves, you wish you spent the time on writing the project in a different language :( Ok, that has been the end of my gripes about Java for today. Sorry :-) -- Nadav Har'El | Thursday, Nov 24 2005, 22 Heshvan 5766 nyh-TS7m/3hpY0sOpacJJkBjfT4kX+cae0hd@xxxxxxxxxxxxxxxx |----------------------------------------- Phone +972-523-790466, ICQ 13349191 |Time is the best teacher. Unfortunately http://nadav.harel.org.il |it kills all its students. ------------------------ Yahoo! Groups Sponsor --------------------~--> Get fast access to your favorite Yahoo! Groups. Make Yahoo! your home page http://us.click.yahoo.com/dpRU5A/wUILAA/yQLSAA/saFolB/TM --------------------------------------------------------------------~-> Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/hackers-il/ <*> To unsubscribe from this group, send an email to: hackers-il-unsubscribe-hHKSG33TihhbjbujkaE4pw@xxxxxxxxxxxxxxxx <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/ |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | RE: How do you choose your programming language ?: 00085, Tzahi Fadida |
|---|---|
| Next by Date: | Preparing for the pugs hackathon: 00085, Gábor Szabó |
| Previous by Thread: | RE: How do you choose your programming language ?i: 00085, Tzahi Fadida |
| Next by Thread: | Re: How do you choose your programming language ?: 00085, Omer Shapira |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |