Memory leaks in standard code

FX Coudert fxcoudert@gmail.com
Sun Feb 24 14:55:00 GMT 2008


> I think that this is a splendid improvement; particularly since there
> is no sign of it if the option is not selected.

Yes, that was a prerequisite from the beginning: all nontrivial  
runtime checking should be selectable and be switched off by default.

> Please consider it to be OK for trunk.

I have plans for an improved version, which I will formally submit  
later (I expect to have lots of free time in the second half of  
March), including the memory usage statistics.

> My attempt to use it for debugging allocatable component memory leaks
> came to nothing, however.  For each and every gfortran.dg/alloc_comp*,
> this message is emitted:
>
> Error in memory deallocation at line 0 of source file '(null)':
> freeing memory that has not been allocated by us.

This means that free() is called on a pointer that was never malloc'ed 
()... Which corresponds to what you say, IIUC, that you're trying to  
call free() on some "static" array. I'm surprise it doesn't fail in a  
more dramatic way in a standard system.


FX

PS: there is a small catch, though: in the current state of the  
patch, realloc() is not handled, so if you have realloc() somewhere,  
that might explain the behaviour you're seeing... although I doubt it.

-- 
François-Xavier Coudert
http://www.homepages.ucl.ac.uk/~uccafco/



More information about the Fortran mailing list