FO
Size: a a a
FO
МБ
KR
KR
FO
KR
FO
FO
KR
МБ
KR
KR
МБ
KR
KR
МБ
FO
function i2allocate(inp_x, inp_y) result(array)
integer(8), intent(in) :: inp_x, inp_y
integer(8), dimension(:,:), pointer :: array
integer(8), target :: X(1) ! but X(capacity)
common /fmcom / X
! new end of array
integer(8) :: temp
if(inp_x*inp_y < 0) call negative_memory
if(inp_x*inp_y == 0) then
nullify(array)
return
end if
temp = shift + inp_x*inp_y
if(temp > capacity) call no_memory
X(shift+offset:temp-1+offset) = 0
array(1:inp_x,1:inp_y) => X(shift+offset:temp-1+offset)
shift = temp
end function i2allocate
subroutine i2deallocate(array)
integer(8), dimension(:,:), pointer :: array
integer(8) :: temp
integer(8), target :: X(1) ! but X(capacity)
common /fmcom / X
temp = shift - size(array)
if(loc(array) == loc(X(temp+offset))) then
shift = temp
nullify(array)
else
call memory_leak
end if
end subroutine i2deallocate
FO
KR
KR