summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDamien Doligez <damien.doligez-inria.fr>2001-12-04 10:53:19 +0000
committerDamien Doligez <damien.doligez-inria.fr>2001-12-04 10:53:19 +0000
commitcae7e511a71f48c48429a6692f056e96c0f30859 (patch)
tree3cafeb6b65a6355f196e55d2115529ac228d5909
parent393ec18f1b74dcd1d1c291d17b4a5c91d15968be (diff)
bug du mode debug
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@4091 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
-rw-r--r--byterun/memory.c7
-rw-r--r--byterun/misc.h7
2 files changed, 6 insertions, 8 deletions
diff --git a/byterun/memory.c b/byterun/memory.c
index a7c104481..0ad4140e2 100644
--- a/byterun/memory.c
+++ b/byterun/memory.c
@@ -320,12 +320,7 @@ void * stat_alloc (asize_t sz)
/* malloc() may return NULL if size is 0 */
if (result == NULL && sz != 0) raise_out_of_memory ();
#ifdef DEBUG
- {
- value *p;
- for (p = result; p < (value *) ((char *) result + sz); p++){
- *p = Debug_uninit_stat;
- }
- }
+ memset (result, Debug_uninit_stat, sz);
#endif
return result;
}
diff --git a/byterun/misc.h b/byterun/misc.h
index 4720e6893..e8206aaa4 100644
--- a/byterun/misc.h
+++ b/byterun/misc.h
@@ -109,9 +109,11 @@ char *aligned_malloc (asize_t, int, void **);
04 -> fields deallocated by obj_truncate
10 -> uninitialised fields of minor objects
11 -> uninitialised fields of major objects
- 12 -> uninitialised words of stat_alloc blocks
15 -> uninitialised words of aligned_malloc blocks
85 -> filler bytes of aligned_malloc
+
+ special case (byte by byte):
+ D7 -> uninitialised words of stat_alloc blocks
*/
#define Debug_free_minor Debug_tag (0x00)
#define Debug_free_major Debug_tag (0x01)
@@ -119,9 +121,10 @@ char *aligned_malloc (asize_t, int, void **);
#define Debug_free_truncate Debug_tag (0x04)
#define Debug_uninit_minor Debug_tag (0x10)
#define Debug_uninit_major Debug_tag (0x11)
-#define Debug_uninit_stat Debug_tag (0x12)
#define Debug_uninit_align Debug_tag (0x15)
#define Debug_filler_align Debug_tag (0x85)
+
+#define Debug_uninit_stat 0xD7
#endif /* DEBUG */