Originally Posted by
Ada Lovelace
Just thought I would throw this up in the air as a convocation piece.
I know Java is a managed language, and all pointer operations are done in-house by the GC,
but let's (for fun) Assume the creators of the language had thought "y;know what? Let's put
manual memory allocation in!"
Take a look at the Unsafe class. It allows for direct memory management.
Link:
Java Magic. Part 4: sun.misc.Unsafe - mishadoff thoughts
But as the name suggests its, well, unsafe...
Originally Posted by
Ada Lovelace
Take video games for example, if the GC has to reallocate memory for each
FPS or module or event, the game would lag badly or run extremely slowly.
Thats just an assumption of you. You can very well code complex 3D games with java without any lag. The trick is to do it right.
Look, for example, at libGdx which is a somewhat more advanced gaming library. There are many games out there which utilize it without having any problems with performance.
Java has become incredibly fast today, there are some java programs which run as fast as C++ because of the great work the JIT usually does.
Originally Posted by
Ada Lovelace
Let's assume that code allocates 150 indexes of memory to the object *ply.
If that object was manually managed, would it preform better or worse?
Just an observation here. The bottom line is, people argue that the GC is slower
than Manual memory - but I think if used correctly (i.e do not go over the index bounds of an
array) then there is nothing wrong with it.
Any thoughts?
Wishes Ada xx
We should really be looking at the future and how to advance programming. Pointers are a relic and working with them quickly becomes a real pain arguably.
Instead of trying to go backwards and re-introduce them we should make sure there is no need for them in the future, and I think java is doing a great job here.
Just my personal opinion on this matter.