[m-rev.] diff: fix `-dm' runtime option

Fergus Henderson fjh at cs.mu.OZ.AU
Wed Dec 31 00:17:04 AEDT 2003


Estimated hours taken: 0.75
Branches: main

Fix a bug in the implementation of the "-dm" (debug memory) runtime option:
it was not printing out the information about the memory zones.

runtime/mercury_memory.c:
runtime/mercury_wrapper.c:
	Don't call debug_memory() at the end of init_memory(),
	because the memory zones haven't been created then.
	Instead, call it in mercury_runtime_init(), after all
	the different memory zones have been initialized.  

	(Also, fix an out-of-date comment in mercury_wrapper.c.)

Workspace: /home/jupiter/fjh/ws-jupiter/mercury
Index: runtime/mercury_memory.c
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_memory.c,v
retrieving revision 1.33
diff -u -d -r1.33 mercury_memory.c
--- runtime/mercury_memory.c	18 Nov 2003 07:49:59 -0000	1.33
+++ runtime/mercury_memory.c	30 Dec 2003 13:07:57 -0000
@@ -230,9 +230,6 @@
 
 	MR_init_zones();
 
-	if (MR_memdebug) {
-		MR_debug_memory();
-	}
 } /* end MR_init_memory() */
 
 /*---------------------------------------------------------------------------*/
Index: runtime/mercury_wrapper.c
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_wrapper.c,v
retrieving revision 1.129
diff -u -d -r1.129 mercury_wrapper.c
--- runtime/mercury_wrapper.c	23 Oct 2003 06:51:24 -0000	1.129
+++ runtime/mercury_wrapper.c	30 Dec 2003 13:12:49 -0000
@@ -130,8 +130,10 @@
 ** amount of heap space still available, and if not, we call
 ** MR_garbage_collect().
 **
-** The collector should (XXX it currently doesn't) recompute this
-** and/or heap_zone->gc_threshold automatically at the end of each collection.
+** XXX Actually, this variable is only used to set the initial value
+** of heap_zone->gc_threshold.
+** The collector recomputes heap_zone->gc_threshold automatically at
+** the end of each collection.
 **
 ** Like the sizes above, it is measured in kilobytes
 ** (but we later multiply by 1024 to convert to bytes).
@@ -521,6 +523,10 @@
 	}
   #endif /* ! MR_THREAD_SAFE */
 #endif /* ! MR_HIGHLEVEL_CODE */
+
+	if (MR_memdebug) {
+		MR_debug_memory();
+	}
 
 	/* initialize profiling */
 

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list