Silverfrost Forums

Welcome to our forums

Problem with ALLOCATE

11 Dec 2018 8:33 #22953

Hello,

I try to use ALLOCATE. In my test program the code below behaves as expected. Variable has the correct dimension of 500000 and assignment is working.

CHARACTER(256), ALLOCATABLE :: TXT(:) 
ALLOCATE(TXT(500000),STAT=IERR) 

When I try to adapt this code in my main program, STAT returns 0, but the dimension is shown as TXT(-1:0) in Salford Debugger 7.10. No assignment is possible. Assigment provides an access violation. I wonder why it behaves different compared to my test program.

11 Dec 2018 9:14 #22954

Your simple test works OK because 256*500000 is less than 2GB and there is enough memory available to allocate off the heap.

If you increase the size of the character array or if there are other significant demands on available memory then you may have problems in your main program.

/CHECK has its own memory limitations for Win32.

64 bit compilation should have fewer memory issues.

Please login to reply.