The actual CVS version has now reference counting for pointer and object.
It actually does not do anything yet, just prints out a message if a heap variable goes out of scope (becomes dangling).
To make it also care for the actual cleanup is now a very little step. However, for a smooth transition I did not want to break the CVS version in case there are still some bugs.
Please check it out and drop a note, if you find any inconsistency (i.e. a wrong or missing message)
Note that an automatic garbadge collection allows a completely different coding style.
Much easier and saver and fits much better to a language like GDL. The yet to be released IDL 8.0 seems to have it as well.
Reference counting does now actually cleanup dangling heap variables.
1. Thanks! It's great to have it.
2. I've added a test_gc.pro to the "make check" (just two examples with pointers for the moment)
3. The "make check" (test_hist_2d.pro) revealed a bug - it works! :) :
GDL> a = & print, *a
Out of scope (garbage collected): <PtrHeapVar1>
% Invalid pointer: <Expression> <POINTER (<PtrHeapVar1>)>
% Execution halted at: $MAIN$
It would be great to add to the warnings some information on the file/line where the reference count reaches zero. For example I get some garbage collection in the CMSV lib (or the GDL wrappers) but there's a substantial amount of code to look at to find the location of the leak.
good idea, now the top of the callstack routine is printed together with the line number.
However this is not always be 100% precise. For example the last code line number is printed when the local variables are cleaned up upon subroutine return. The line number is not always set (0). But I think it will help.
Log in to post a comment.
Sign up for the SourceForge newsletter:
You seem to have CSS turned off.
Please don't fill out this field.