diff options
author | Joseph Hunkeler <jhunkeler@gmail.com> | 2015-07-08 20:46:52 -0400 |
---|---|---|
committer | Joseph Hunkeler <jhunkeler@gmail.com> | 2015-07-08 20:46:52 -0400 |
commit | fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4 (patch) | |
tree | bdda434976bc09c864f2e4fa6f16ba1952b1e555 /sys/nmemio/mfini.x | |
download | iraf-linux-fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4.tar.gz |
Initial commit
Diffstat (limited to 'sys/nmemio/mfini.x')
-rw-r--r-- | sys/nmemio/mfini.x | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/sys/nmemio/mfini.x b/sys/nmemio/mfini.x new file mode 100644 index 00000000..f3933fa1 --- /dev/null +++ b/sys/nmemio/mfini.x @@ -0,0 +1,57 @@ +# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc. + +include <syserr.h> +include <config.h> + + +define MDEBUG false + +# MEM_FINI -- Close out the MEMIO use in this task. We perform the memory +# garbage collection and report usage statistics if requested. + +procedure mem_fini (task) + +char task[ARB] # task name + +int sv_report + +include "nmemio.com" + +begin + # Do garbage collection. + call mgc_collect() + + # Turn off reporting so the print statements below don't add + # to the reported values. + sv_report = mreport + mreport = 0 + mdebug = 0 + in_task = 0 + + if (MDEBUG) { + call eprintf ("\nTask '%s':\n") + call pargstr (task) + call eprintf (" mwatch:\t%d\n") ; call pargi (mwatch) + call eprintf (" mclear:\t%d\n") ; call pargi (mclear) + call eprintf (" mcollect:\t%d\n") ; call pargi (mcollect) + call eprintf (" mreport:\t%d\n") ; call pargi (mreport) + } + + # Report memory usage. + if (sv_report > 0) { + call eprintf ("\nTask '%s':\n") + call pargstr (task) + call eprintf (" Memory:\t%9d used (%9d max )\n") + call pargl (mem_used) + call pargi (max_alloc) + call eprintf (" Pointers:\t%9d alloc (%9d free)\n") + call pargi (nalloc) + call pargi (nfree) + call eprintf (" Leaked:\t%9d bytes (%9d ptrs)\n\n") + call pargl (leaked) + call pargl (nleaked) + } + + # Free the GC buffer. + call mgc_close () +end |