replica nfl jerseysreplica nfl jerseyssoccer jerseyreplica nfl jerseys forums.silverfrost.com :: View topic - Neverending Memory Grow.!! It seems deallocate doesn`t release memory.
forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Neverending Memory Grow.!! It seems deallocate doesn`t release memory.

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support
View previous topic :: View next topic  
Author Message
rpetite



Joined: 25 Feb 2005
Posts: 5

PostPosted: Fri Feb 25, 2005 6:30 am    Post subject: Neverending Memory Grow.!! It seems deallocate doesn`t relea Reply with quote

Hi all,

I have a serious problem with memory. Hope anyone can help me.This is what happens:


In my application, there are many arrays (large arrays,i.e real*4 array(60000,180)). Besides, these arrays are passed as arguments among the diferent subroutines. And what is the worst...these subroutines can be called too many times (80000 - 100000 times aprox).

At the beggining, I used these arrays as static (I had only used Fortran77 until this application). The consequences were that after a time of execution I got stack overflow. Then, using ftn95 advantages, I used allocatable arrays and pointers to pass them as arguments, and deallocate to avoid the overflow. Now I do not have stack overflow.

However, if I use the Window Task Manager(Ctrl+Alt+Spr) and see the performance tab, the memory increases and doesn�t stop. The program works o.K but it seems it doesn�t release memory, and in some cases, if I have large arrays the program 'cracks'. Now I have defined all the variables, arrays as dynamic, but memory still grows. Anyway, and tell me if I am wrong, the local variables are supposed to be released when subroutines end. And when a 'deallocate(array)', the memory is also suposed to be released. In my program, the memory is only released when the program is exited.

If this can help you..I am using .NET platform (a c# program, and I call the fortran routine from c#). Is there garbage collector in FTN95, is my problem diferent. In the other side, I have read the previous thread about editbin, but I am not sure if is the same problem as mine.

Sorry by the large writting but I think it was necessary. It is difficult to explain. Thanks a lot. Regards
Roberto
Back to top
View user's profile Send private message
Andrew



Joined: 09 Sep 2004
Posts: 232
Location: Frankfurt, Germany

PostPosted: Fri Feb 25, 2005 2:16 pm    Post subject: Neverending Memory Grow.!! It seems deallocate doesn`t relea Reply with quote

Are you compiling the project in CheckMate mode? If so, because of the way CheckMate works, new memory is used in preference to reusing released memory until the physical memory is exhausted, then released memory is reused. This ensures that variable checking can be done accurately. If you are compiling/running as CheckMate try changing to Debug and see if the problem persists. If this does not solve your issue it may be a programming error, if you post an working example of the code that is behaving this way someone may be able to help more - please keep the example as small as possible.
Back to top
View user's profile Send private message
rpetite



Joined: 25 Feb 2005
Posts: 5

PostPosted: Mon Feb 28, 2005 2:05 am    Post subject: Neverending Memory Grow.!! It seems deallocate doesn`t relea Reply with quote

Thanks Andrew for your quick answer.

I am compiling in debug mode (no in CheckMate mode). Here you have an example of the code I am using. I have summed it up to make it clear. Basically,I have tried to show the way I am allocating memory and passing arguments (as pointers) between subroutines.




! Stub to call the this fortran routines from C#

SUBROUTINE ANALYSIS_STUB(NM, ERROR)

ASSEMBLY_INTERFACE (NAME="Analysis")


INTEGER*1 NM
INTEGER*1 ERROR(Smile

CALL ANALYSIS(NM,ERROR)

ENDSUBROUTINE


SUBROUTINE ANALYSIS(NM, ERROR)

! interface to be able to pass pointers as arguments
INTERFACE

SUBROUTINE My_Subroutine(matrix,NPOINT,temp_matrix,
# NM, ERROR)

real*4,pointer::matrix(:,Smile

INTEGER*4,pointer::NPOINT
INTEGER*1,pointer::NM

INTEGER*1,pointer::temp_matrix(Smile
INTEGER*1,pointer:: ERROR(Smile

END SUBROUTINE My_Subroutine


END INTERFACE

!Variables Declaration

INTEGER*2 N_BLOQUE

! Targets
INTEGER*1,target:: NM
INTEGER*1,target:: ERROR(10)
INTEGER*4,target::NTEMP

! Dynamic Arrays

REAL*4, ALLOCATABLE:: matrix(:,Smile
INTEGER*1,ALLOCATABLE::temp_matrix(Smile

! Pointers
REAL*4,pointer::p_matrix(:,Smile
INTEGER*1,pointer::p_temp_matrix(Smile
INTEGER*4,pointer::p_ntemp


ALLOCATE (matrix(60000,180))


p_matrix=>matrix
p_ntemp=>ntemp


DO 30 i=1,60000
ALLOCATE(temp_matrix(20000))
p_temp_matrix=>temp_matrix
temp_matrix(M)=2
CALL My_Subroutine(p_matrix,p_ntemp,p_temp_matrix,pERROR)
deallocate(temp_control)
30 continue
deallocate(temp)

900 END



! The body of My_Subroutine has not been included in order to not complicate the example.


Back to top
View user's profile Send private message
rpetite



Joined: 25 Feb 2005
Posts: 5

PostPosted: Mon Feb 28, 2005 2:12 am    Post subject: Neverending Memory Grow.!! It seems deallocate doesn`t relea Reply with quote

Sorry, when I tried to make the code clearer, I made a mistake in the line I have now put in bold and big font. Sorry for the confussion Sad(

! Stub to call the this fortran routines from C#

SUBROUTINE ANALYSIS_STUB(NM, ERROR)

ASSEMBLY_INTERFACE (NAME="Analysis")


INTEGER*1 NM
INTEGER*1 ERROR(Smile

CALL ANALYSIS(NM,ERROR)

ENDSUBROUTINE


SUBROUTINE ANALYSIS(NM, ERROR)

! interface to be able to pass pointers as arguments
INTERFACE

SUBROUTINE My_Subroutine(matrix,NPOINT,temp_matrix,
# NM, ERROR)

real*4,pointer::matrix(:,Smile

INTEGER*4,pointer::NPOINT
INTEGER*1,pointer::NM

INTEGER*1,pointer::temp_matrix(Smile
INTEGER*1,pointer:: ERROR(Smile

END SUBROUTINE My_Subroutine


END INTERFACE

!Variables Declaration

INTEGER*2 N_BLOQUE

! Targets
INTEGER*1,target:: NM
INTEGER*1,target:: ERROR(10)
INTEGER*4,target::NTEMP

! Dynamic Arrays

REAL*4, ALLOCATABLE:: matrix(:,Smile
INTEGER*1,ALLOCATABLE::temp_matrix(Smile

! Pointers
REAL*4,pointer::p_matrix(:,Smile
INTEGER*1,pointer::p_temp_matrix(Smile
INTEGER*4,pointer::p_ntemp
[big]integer*1,pointer::p_error(Smile[/big]


ALLOCATE (matrix(60000,180))


p_matrix=>matrix
p_ntemp=>ntemp
[big]p_error=>error[/big]

DO 30 i=1,60000
ALLOCATE(temp_matrix(20000))
p_temp_matrix=>temp_matrix
temp_matrix(M)=2
CALL My_Subroutine(p_matrix,p_ntemp,p_temp_matrix,p_ERROR)
[big]deallocate(temp_matrix)[/big]
30 continue
deallocate(temp)

900 END

Back to top
View user's profile Send private message
rpetite



Joined: 25 Feb 2005
Posts: 5

PostPosted: Mon Feb 28, 2005 2:16 am    Post subject: Neverending Memory Grow.!! It seems deallocate doesn`t relea Reply with quote

The last one!!!. I am a dissater. The administrator is going to kill me. Soooooorrry

Sorry, when I tried to make the code clearer, I made a mistake in the line I have now put in bold and big font. Sorry for the confussion

! Stub to call the this fortran routines from C#

SUBROUTINE ANALYSIS_STUB(NM, ERROR)

ASSEMBLY_INTERFACE (NAME="Analysis")


INTEGER*1 NM
INTEGER*1 ERROR(Smile

CALL ANALYSIS(NM,ERROR)

ENDSUBROUTINE


SUBROUTINE ANALYSIS(NM, ERROR)

! interface to be able to pass pointers as arguments
INTERFACE

SUBROUTINE My_Subroutine(matrix,NPOINT,temp_matrix,
# NM, ERROR)

real*4,pointer::matrix(:,Smile

INTEGER*4,pointer::NPOINT
INTEGER*1,pointer::NM

INTEGER*1,pointer::temp_matrix(Smile
INTEGER*1,pointer:: ERROR(Smile

END SUBROUTINE My_Subroutine


END INTERFACE

!Variables Declaration

INTEGER*2 N_BLOQUE

! Targets
INTEGER*1,target:: NM
INTEGER*1,target:: ERROR(10)
INTEGER*4,target::NTEMP

! Dynamic Arrays

REAL*4, ALLOCATABLE:: matrix(:,Smile
INTEGER*1,ALLOCATABLE::temp_matrix(Smile

! Pointers
REAL*4,pointer::p_matrix(:,Smile
INTEGER*1,pointer::p_temp_matrix(Smile
INTEGER*4,pointer::p_ntemp
integer*1,pointer::p_error(Smile


ALLOCATE (matrix(60000,180))


p_matrix=>matrix
p_ntemp=>ntemp
p_error=>error

DO 30 i=1,60000
ALLOCATE(temp_matrix(20000))
p_temp_matrix=>temp_matrix
temp_matrix(M)=2
CALL My_Subroutine(p_matrix,p_ntemp,p_temp_matrix,p_ERROR)
deallocate(temp_matrix)
30 continue
deallocate(matrix)

900 END
Back to top
View user's profile Send private message
Anonymous
Guest





PostPosted: Wed Mar 23, 2005 5:08 am    Post subject: Neverending Memory Grow.!! It seems deallocate doesn`t relea Reply with quote

We have identified a bug in FTN95 that is likely to be the source of your problem.
This bug has now been fixed and a new full release is imminent (hopefully within the next two weeks).
This failure to release de-allocated memory is confined to .NET so, if possible, you should use Win32 for the time being.
Back to top
rpetite



Joined: 25 Feb 2005
Posts: 5

PostPosted: Tue Mar 29, 2005 12:46 am    Post subject: Neverending Memory Grow.!! It seems deallocate doesn`t relea Reply with quote

Thanks a lot Paul,

Finally, I translated it into c# so the garbage collector cares about memory release. Anyway it is important for other people to know about that bug. I will take it into account for the next time and with the full new FTN95 release.

Thank you again.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group