poldek: trurlib/libtrurl.sym, trurlib/nmalloc.c - diagnostic n_all...
mis
mis at pld-linux.org
Sun Aug 20 16:08:22 CEST 2006
Author: mis Date: Sun Aug 20 14:08:22 2006 GMT
Module: poldek Tag: HEAD
---- Log message:
- diagnostic n_alloc_debug_dump() and warning on huge chunks
---- Files affected:
poldek/trurlib:
libtrurl.sym (1.2 -> 1.3) , nmalloc.c (1.14 -> 1.15)
---- Diffs:
================================================================
Index: poldek/trurlib/libtrurl.sym
diff -u poldek/trurlib/libtrurl.sym:1.2 poldek/trurlib/libtrurl.sym:1.3
--- poldek/trurlib/libtrurl.sym:1.2 Fri May 13 20:41:47 2005
+++ poldek/trurlib/libtrurl.sym Sun Aug 20 16:08:17 2006
@@ -1,3 +1,4 @@
+n_alloc_debug_dump
n_alloc_free
n_alloc_new
n_array_bsearch_ex
================================================================
Index: poldek/trurlib/nmalloc.c
diff -u poldek/trurlib/nmalloc.c:1.14 poldek/trurlib/nmalloc.c:1.15
--- poldek/trurlib/nmalloc.c:1.14 Mon Jun 13 22:26:45 2005
+++ poldek/trurlib/nmalloc.c Sun Aug 20 16:08:17 2006
@@ -61,9 +61,8 @@
void *n_malloc(size_t size)
{
register void *v;
-
if ((v = malloc(size)) == NULL)
- nomem();
+ nomem();
return v;
}
@@ -208,6 +207,13 @@
return new;
}
+void n_alloc_debug_dump(tn_alloc *na)
+{
+ fprintf(stderr, "%p chunk_size %ld\n", na,
+ ((struct obstack*)na->_privdata)->chunk_size);
+}
+
+
tn_alloc *n_alloc_new(size_t chunkkb, unsigned int flags)
{
tn_alloc *na;
@@ -228,6 +234,12 @@
obstack_init(ob);
if (chunkkb < 2)
chunkkb = 2;
+
+ if (chunkkb > 4096)
+ fprintf(stderr, "n_alloc_new: do you really request obstack's "
+ "chunk size greater than 4M?\n");
+
+
obstack_chunk_size(ob) = 1024 * chunkkb;
#if HAVE_CPU_UNALIGNED_ACCESS
obstack_alignment_mask(ob) = 0; /* TODO: configurable */
================================================================
---- CVS-web:
http://cvs.pld-linux.org/poldek/trurlib/libtrurl.sym?r1=1.2&r2=1.3&f=u
http://cvs.pld-linux.org/poldek/trurlib/nmalloc.c?r1=1.14&r2=1.15&f=u
More information about the pld-cvs-commit
mailing list