I am using GET_STORAGE@ to grab 240Mb of memory and then releasing it with RETURN_STORAGE@, but when I try and get the same amount of memory again I find it is not available. I have narrowed it down to a small program as follows and I am using John Campbells 'report_free_memory_chunks' routine. If GET_MEMORY and FREE_MEMORY are commented out, this reports that the largest memory block available is 1502Mb, but after a call to GET_MEMORY, it reports the same figure of 1262Mb whether FREE_MEMORY is called or not. i.e. The number doesn't revert back or show up in any other free blocks. Am I missing something ?
PROGRAM MEMTST
*------------------------
- Implicit definition * *------------------------
-
IMPLICIT INTEGER (A-Z) -
TOTAL=31488861 CALL GET_MEMORY(TOTAL,8,IERROR) CALL FREE_MEMORY call report_free_memory_chunks(0) STOP END -
SUBROUTINE GET_MEMORY(NCELLS,ISIZE,IERROR) -
+---------------------------------------------------+ -
| Subroutine : GET_MEMORY | -
| Description: Get virtual memory | -
+---------------------------------------------------+
*------------------------
- Implicit definition * *------------------------
-
IMPLICIT INTEGER (A-Z) SAVE COREADDRESS
*----------------------------
- Compute memory required * *----------------------------
-
NREQUIRED=(NCELLS+1)*ISIZE
*-----------------------
- Get virtual memory * *-----------------------
-
CALL GET_STORAGE@(COREADDRESS,NREQUIRED) write(*,*)'GET: coreaddress = ',coreaddress IF(COREADDRESS.EQ.-1) THEN IERROR=1 RETURN END IF
*------------
- Success * *------------
-
IERROR=0 RETURN -
+---------------------------------------------------+ -
| Entry : FREE_MEMORY | -
| Description: Free virtual memory | -
+---------------------------------------------------+ -
ENTRY FREE_MEMORY
*------------------------
- Free virtual memory * *------------------------
-
write(*,*)'FREE: coreaddress = ',coreaddress CALL RETURN_STORAGE@(COREADDRESS) RETURN END