replica nfl jerseysreplica nfl jerseyssoccer jerseyreplica nfl jerseys forums.silverfrost.com :: View topic - Access violation with SHARENAME
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 

Access violation with SHARENAME

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



Joined: 30 Aug 2007
Posts: 51
Location: munich

PostPosted: Mon Jul 27, 2009 9:26 am    Post subject: Access violation with SHARENAME Reply with quote

Hello,

I have tried to use the new feature to share common memory. But I had program crashes (with access violation) when I used an array twice with different sizes. See the following sample code:
Code:

integer :: i
real*4,allocatable,dimension(:)  :: a

  allocate(a(3), SHARENAME="MyMemory2")

  a(1) = 1.
  a(2) = 2.
  a(3) = 3.
 
  write(*,*) a

  deallocate(a)
 
  allocate(a(2048), SHARENAME="MyMemory2")

  do i=1,2048
    a(i) = float(i)
  enddo 

  write(*,*) a
 
end


with the debugger I can see, that the array "a" shows "Illegal pointer" at position 1025 and further after the second allocate command. Is there a way to release also the sharename, when dellocating the array?

Thanks,

Ralf
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 8211
Location: Salford, UK

PostPosted: Mon Jul 27, 2009 7:47 pm    Post subject: Reply with quote

This needs some careful thought.

The general idea is that the memory will be released when all processes that share the memory have terminated.

To force the memory to be released may need a call of the form

call unmap_file@(loc(a))

but this is not built into deallocate because another process could be sharing the memory.

If you try to unmap the file in the code then this also causes problems.

Given a little more time, I may be able to come up with a sensible modification for the next release.
Back to top
View user's profile Send private message AIM Address
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 8211
Location: Salford, UK

PostPosted: Mon Aug 31, 2009 12:36 pm    Post subject: Reply with quote

For the next release I have added a subroutine that you can call before deallocate.

In your code it will take the form:

Code:
CALL enable_deallocate@(a)
deallocate(a)


The new routine has the interface

Code:
C_EXTERNAL ENABLE_DEALLOCATE@ '__enable_deallocate' (REF)
Back to top
View user's profile Send private message AIM Address
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