all grids leak memory
All grid runs leak serious amount of memory. On line 591 of iter_startend.cpp, LineSvSortWL is allocated without previously deallocating the array from the previous iteration of the grid like is done for LineSv a few lines up. It still needs to be checked whether simply adding
if( LineSvSortWL != NULL )
free( LineSvSortWL );
in front of the MALLOC call is safe and sufficient.
In the long run it would better to convert this into a C++ container, preferably one that sorts implicitly, like map. That way we could also remove the call to qsort() and the extern "C" routine wavelength_compare() in prt_lines.cpp.
This needs to be fixed both on the trunk and c10_branch