changeset 1280:8d76b6216102

* cdl/memalloc.cdl, src/dlmalloc.cxx: Make the minimum memory alignment a configuration option for Doug Lea's memory allocator.
author asl
date Mon, 06 Oct 2003 16:41:07 +0000
parents fa9ec33a5ad1
children f58b62f3c85d
files packages/services/memalloc/common/current/ChangeLog packages/services/memalloc/common/current/cdl/memalloc.cdl packages/services/memalloc/common/current/src/dlmalloc.cxx
diffstat 3 files changed, 22 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/packages/services/memalloc/common/current/ChangeLog
+++ b/packages/services/memalloc/common/current/ChangeLog
@@ -1,3 +1,8 @@
+2003-09-30  Eric Doenges <Eric.Doengea@DynaPel.com>
+
+	* cdl/memalloc.cdl, src/dlmalloc.cxx: Make the minimum memory
+	alignment a configuration option for Doug Lea's memory allocator.
+
 2003-02-05  Jonathan Larmour  <jifl@eCosCentric.com>
 
 	* include/memjoin.inl: Don't use default arg in definition.
--- a/packages/services/memalloc/common/current/cdl/memalloc.cdl
+++ b/packages/services/memalloc/common/current/cdl/memalloc.cdl
@@ -184,6 +184,18 @@ cdl_package CYGPKG_MEMALLOC {
                     to use some macro equivalents, which some people report
                     are faster in some circumstances."
            }
+
+           cdl_option CYGNUM_MEMALLOC_ALLOCATOR_DLMALLOC_ALIGNMENT {
+                display       "Minimum alignment of allocated blocks"
+                flavor        data
+                legal_values  3 to 10
+                default_value 3
+                description   "
+                    This option controls the minimum alignment that the
+                    allocated memory blocks are aligned on, specified as
+                    2^N. Note that using large mininum alignments can lead
+                    to excessive memory wastage."
+           }
         }
 
         cdl_component CYGPKG_MEMALLOC_ALLOCATOR_SEPMETA {
--- a/packages/services/memalloc/common/current/src/dlmalloc.cxx
+++ b/packages/services/memalloc/common/current/src/dlmalloc.cxx
@@ -495,6 +495,11 @@ typedef struct Cyg_Mempool_dlmalloc_Impl
 /*  sizes, alignments */
 
 #define SIZE_SZ                (sizeof(INTERNAL_SIZE_T))
+
+#ifdef CYGNUM_MEMALLOC_ALLOCATOR_DLMALLOC_ALIGNMENT
+#define MALLOC_ALIGNMENT (1<<(CYGNUM_MEMALLOC_ALLOCATOR_DLMALLOC_ALIGNMENT))
+#endif
+
 #ifndef MALLOC_ALIGNMENT
 #define MALLOC_ALIGN           8
 #define MALLOC_ALIGNMENT       (SIZE_SZ + SIZE_SZ)