mardi 27 janvier 2015

Fortran incorrect checksum for freed object


I am running a fortran code I wrote myself. The code works fine : each functions execute properly and does what I expect.


To simplify I have construct large complex matrices to solve a linear problem


M*X = B and I solve for X The problem is well defined. I change some parameters in M so I recompute M several times. But as I do so I get this error


malloc: * error for object 0x7f8f3be007e8: incorrect checksum for freed object - object was probably modified after being freed. * set a breakpoint in malloc_error_break to debug


This happens after a random number of execution (sometimes after 3 steps, sometimes after 5,...)


I found exactly where it happens.


In my function function generateM(n,some parameters) result(theMatrix) ! create the matrix here ! n is the size of the matrix and i have some other parameters integer, intent(in) :: n intent(in) :: some parameters complex*16, dimension(n,n) :: theMatrix theMatrix = something end function generateM the matrix is properly constructed but apparently is freed before the program exit... I can even print it to the screen!! (I have a function printMat) This proves that the function properly finish its duty but yet an issue happens when the result is returned...


Anybody knows why?


Is there a memory overflow? Is not the memory freed after each function call such that all the parameters I generate are freed?


Thanks


Remi





Aucun commentaire:

Enregistrer un commentaire