Posts

Showing posts from August, 2012

Java and referencing

Given that the last post was all about pointers and references in C++, it is only fair that i do justice to my first love (Java) and talk about parameter passing and referencing in it. Now b eing a managed language, there is no memory management as such in Java, so no pointers no keeping track of what memory is being used where. So how does that work? well there is the Java garbage collector, which periodically (to my knowledge, there really is no telling exactly when) does the rounds and deletes any objects that are no longer being referenced. To go into the details of the garbage collector (GC) and reference counting and related concepts deserves a post on its own, so i will just skip it here. Anyway so yeah.... GC  woohhuuuu, we can focus solely on the business logic and not worry about dangling pointers and other memory related grief. Now this is awesome, i mean it really is, however it does have its cons, Java programs run slower because of  the  GC  compared to...