From fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4 Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Wed, 8 Jul 2015 20:46:52 -0400 Subject: Initial commit --- sys/nmemio/mfini.x | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 sys/nmemio/mfini.x (limited to 'sys/nmemio/mfini.x') 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 +include + + +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 -- cgit