In order to see the memory not being freed compile the following program:
-------------------------------------------------------------------------
#include <stdio.h>
#include <gsl/gsl_matrix.h>
#include <curses.h>
int
main (void)
{
int i, j;
int c = 5000;
initscr();
cbreak();
gsl_matrix * m[c];
printw("press any key to allocate matrices...");
getch();
for (i = 0; i < c; i++)
m[i] = gsl_matrix_calloc (100, 100);
printw("press any key to free the memory ...");
getch();
for (i = 0; i < c; i++)
gsl_matrix_free (m[i]);
printw("press any key to exit... ");
getch();
endwin();
return 0;
}
// compile with :
// gcc -L/usr/local/lib test.c -lgsl -lgslcblas -lm -lcurses
-------------------------------------------------------------------------
Run the program and look in the top what is happening to its memory. can be
done in a separate terminal window with:
top -d 1 -p $(ps -A | grep a.out | sed -e 's/^ *//g'|sed -e 's/ .*//g')
Basically, the memory is not being freed. This is a very strange bug, because
for some matrix sizes the memory is freed, for some it is not.
I have tried this little code snippet at Ubuntu Feisty and Gutsy with the same
outcome. Feisty's gsl version is 1.8.3, Gutsy's is 1.9.
Can this be corrected?
Thanks!
--
Sergey
_______________________________________________
Bug-gsl mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/bug-gsl