Open abonander opened 11 years ago
I can't remember the reason for why that was added (if there was even a reason at all). I'll try contacting Bastvera (one of the previous programmers who did the bulk of Alliance's coding).
I think a refactoring would be a great idea. The majority of that code is so out dated and untouched I'm sure you'll find some stuff like above that could be done a better way. Feel free to tackle that task.
That method is a part of Console functionality, you simply put 'gc' in Alliance Console and it will execute that Method. It is NOT (and it shouldn't be) part of normal program flow. This is something old, made by original author, probably to VERY simply check memory usage because at the time when Alliance were created Debugging was not so fancy and powerful like is today. The best would be to remove this method completely.
FYI. Bastvera is one of the major contributors to Alliance that no longer has time to actually code anymore. He'll be answering questions on here every so often.
I was looking through some of the code (I was looking for the entry point of the program so I could start building a mental map of the execution), and I found what I was taught is a Java no-no in org.alliance.launchers.console.Console:
Explicit calls to
System.gc()
, and a convenience method to attempt to force garbage collection by calling for it twice. I don't see any reason for usage of this in the current state of Java and this extra method call might actually be adding more overhead than it saves by invoking garbage collection.I'm going to make this my first task on this project. It's simple refactoring, but I think it needs to be done.