! err696_mem_err_report.jnl
! 1/21/2016 *acm*
! V702: *sh* 2/17 - This script depends upon the specific formatting
! of the error string, when memory is exceeded
! Tweaked it to match the new formatting

! Ticket 2354: The error message shows the wrong number for memory needed.
!
! Try to load some data larger than the default amount of memory

let memsize = ($ferret_memory)
set mem/siz=2


def axis/x=1:360:1 xaxis
def axis/y=1:180:1 yaxis
def axis/z=1:20:1 zaxis
define axis/t=1-jan-2000:1-jan-2005:1/units=days  longtime

let bigvar = x[gx=xaxis]+y[gy=yaxis] + z[gz=zaxis] + t[gt=longtime]
sh grid bigvar


set mode ignore
load/l=1:5 bigvar

! Previously the number Mwords shown was too low
show sym fer_last_error
cancel mode ignore

! V702:  we no longer have to parse the error string.
! Instead look at PEAK_MEMORY 

SET MEMORY/SIZE=15
load/l=1:5 bigvar
SHOW SYMBOL ($PEAK_MEMORY)

! restore default
set mem/siz=`memsize`

