Re: memory not freed up?
- From: "fj" <francois.jacq@xxxxxxx>
- Date: 28 Oct 2005 07:42:55 -0700
This seems simple but it is not !
The problem probably comes from the global use of the computer memory.
Languages like C and F90 allocate fixed parts of the memory. Then, when
a lot of allocate/deallocate (or malloc/free) instructions are
performed, then the memory becomes a sort of chain, ramaining allocated
objects being separated by holes (memory deallocated previously). When
allocating a new large amount of memory, the compiler has to choice
between selecting a zone which has never been allocated before, or
finding a hole just large enough to contain the requirement.
By experience, (I wrote a long time ago a library to manage memory in
F77 programs), finding a hole may be an expensive task. So, sometimes,
holes become dead zones especially if several independent programs are
running together.
In my library, I decided to make possible to move arrays from time to
time in order to suppress dead zones. But such a technique assumes a
double pointer association, the "pointer" managed by programs pointing
to the address of the address of the memory zone. Then, moving a memory
zone does not change the first address (only the second one).
In a language like JAVA, the garbage collector is authorized to move
objects. This is one of the reasons which make the coupling java->C or
java->Fortran not obvious.
.
- Follow-Ups:
- Re: memory not freed up?
- From: Rich Townsend
- Re: memory not freed up?
- References:
- memory not freed up?
- From: cluenewbieblue
- memory not freed up?
- Prev by Date: Coupling Fortran Code with Simulink
- Next by Date: Re: Large code projects [Was: equivalencing a charactor string array to a double array]
- Previous by thread: memory not freed up?
- Next by thread: Re: memory not freed up?
- Index(es):
Relevant Pages
|