Quote:
Originally Posted by lanceA
As Dr. Jim stated, I did say that at times I need to reboot to flush memory after using Alice. However I'm not sure my problem is attributable to 'memory leaks' as much as it might be attributable to memory not being "cleared/released" when the program no longer requires it.
Java has 'garbage collection' - However, I can find NO information concerning how this is implemented. Is it cleared if your program errors out ? Java was interrupted in the process of running a program - does it know to go back and clear memory it has reserved? I seriously doubt it . . .
I'm not sure how Python clears memory when it is no longer required, or errors out.
In C we have to physically release memory when it is no longer required.
Where Alice falls within these languages I am uncertain.
However since Alice 3.0 is a Work In Progress (WIP) perhaps we don't have to concern ourselves with this. 
|
The use of garbage collection versus purposeful c-style delete commands was highly controversial in the late 90s when Java first became prominent. However, I believe that Microsoft later adopted garbage collection for C#, Managed C++, and VB.net, and that seems to tamped the controversy down somewhat.
I also doubt that the Java virtual machine and its garbage collector knows to go back and clear memory when it errors out. However, I have
assumed for years
(perhaps incorrectly) that whenever a program written in any language is running under the auspices of the operating system, when that program terminates for any reason, the OS is smart enough to recover all of the memory that was occupied by the terminated program. My reasoning has been
(again possibly incorrect) that the program allocates memory only with the permission of the OS and therefore the OS knows all about the memory that the program has allocated. Therefore, the OS
should be able to recover all of that memory. After all, the Java virtual machine is simply another executable program.
However, when I was in industry, I had a poster on my wall that showed a cartoon character of a little cowboy with a big gun on his hip and a big hole in his foot and a caption that read:
"Don't never assume nothin."
That would probably be good advice for me to consider in the case of garbage collection, be it Java, C#, VB.net, or Managed C++.
Dick Baldwin
Free Alice tutorials:
http://www.dickbaldwin.com/tocalice.htm
Free programming tutorials:
http://www.dickbaldwin.com/toc.htm