Revision: 54869
          http://brlcad.svn.sourceforge.net/brlcad/?rev=54869&view=rev
Author:   brlcad
Date:     2013-03-26 03:04:25 +0000 (Tue, 26 Mar 2013)
Log Message:
-----------
support a wider range of allocation request sizes (1-1024) but keep page sizes 
at 1MB per size.  add the ability to bomb on out-of-range requests so they can 
be traced.

Modified Paths:
--------------
    brlcad/trunk/src/libbu/heap.c

Modified: brlcad/trunk/src/libbu/heap.c
===================================================================
--- brlcad/trunk/src/libbu/heap.c       2013-03-26 02:49:07 UTC (rev 54868)
+++ brlcad/trunk/src/libbu/heap.c       2013-03-26 03:04:25 UTC (rev 54869)
@@ -34,7 +34,7 @@
  * size will allocate at least one page).  PAGESIZE should be some
  * multiple larger than BINS.
  */
-#define BINS 256
+#define BINS 1024
 
 /**
  * This specifies how much memory we should preallocate for each
@@ -47,7 +47,7 @@
  * Embedded or memory-constrained environments probably want to set
  * this a lot smaller than the default.
  */
-#define PAGESIZE (BINS * 4096)
+#define PAGESIZE (BINS * 1024)
 
 /**
  * heaps is an array of lists containing pages of memory binned per
@@ -130,8 +130,14 @@
 
     if (sz > BINS || sz == 0) {
        misses++;
-       if (bu_debug)
+
+       if (bu_debug) {
            bu_log("DEBUG: heap size %zd out of range\n", sz);
+
+           if (bu_debug & (BU_DEBUG_COREDUMP | BU_DEBUG_MEM_CHECK)) {
+               bu_bomb("Intentionally bombing due to BU_DEBUG_COREDUMP and 
BU_DEBUG_MEM_CHECK\n");
+           }
+       }
        return bu_calloc(1, sz, "heap calloc");
     }
 

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Own the Future-Intel® Level Up Game Demo Contest 2013
Rise to greatness in Intel's independent game demo contest.
Compete for recognition, cash, and the chance to get your game 
on Steam. $5K grand prize plus 10 genre and skill prizes. 
Submit your demo by 6/6/13. http://p.sf.net/sfu/intel_levelupd2d
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to