- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am working ona Fortran95 CFD code and when I use FORALL statements with pure functionsit causes memory leaks,following line is an example ofthe code that causes the problem:
FORALL(L=nlic(nb):nli(nb)) phi(li(L),ndphidtime) = interpp3n_r0(phi(li(L),phikey(phase,sphi,1:3)),r1,dt(1:2)),
where nlic, nli, li and phikey are integer arrays, r1 is a real, phi(:,:) and dtare real arraysand interpp3n_r0 is a pure function. It seems the compiler allocates temporary arrays but neverfrees them. The code works just fine when I change the Forall to DO loops.
I am using Intel FORTRAN compiler 11.1 integrated into the VS 2008 professional.
I amnew to the forumand sorry if the issue is already discussed,
Thank you
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
We would need to see a small(if possible) but complete example in order to investigate this. What sort of memory leak are you referring to?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you for the reply. I've attached two files: test.f90 is the main code and funcs.f90 contains two functions that are called by the main program.In the following do loop (line 22 of test.f90) the size of the program starts to grow after each call to FORALL.
Do i = 1,10
FORALL(L=1:mil) phi(li(L),3) = interpp3n_r0(phi(li(L),range),r1,dx(1:2))
ENDDO
This is exactly what happens in the code and the program size grows until the machine runs out of memory.
Thank you
sina
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yes but if you makethe arraylarger or run it longer (i = 1,1000 for example) it will eventually crash. anyway I can't change the heap-arrays as there are lots of large arrays passed to subroutines and I get stack over flows, however I'm considering changing foralls to do loops as I am also having problems with pointer assignmentsand foralls. I probably convert foralls to do loops, there arelots of them though.
Thank you for the help
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page