1 |
786 |
skrzyp |
# ====================================================================
|
2 |
|
|
#
|
3 |
|
|
# memalloc.cdl
|
4 |
|
|
#
|
5 |
|
|
# Dynamic memory allocator services configuration data
|
6 |
|
|
#
|
7 |
|
|
# ====================================================================
|
8 |
|
|
## ####ECOSGPLCOPYRIGHTBEGIN####
|
9 |
|
|
## -------------------------------------------
|
10 |
|
|
## This file is part of eCos, the Embedded Configurable Operating System.
|
11 |
|
|
## Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
|
12 |
|
|
##
|
13 |
|
|
## eCos is free software; you can redistribute it and/or modify it under
|
14 |
|
|
## the terms of the GNU General Public License as published by the Free
|
15 |
|
|
## Software Foundation; either version 2 or (at your option) any later
|
16 |
|
|
## version.
|
17 |
|
|
##
|
18 |
|
|
## eCos is distributed in the hope that it will be useful, but WITHOUT
|
19 |
|
|
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
20 |
|
|
## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
21 |
|
|
## for more details.
|
22 |
|
|
##
|
23 |
|
|
## You should have received a copy of the GNU General Public License
|
24 |
|
|
## along with eCos; if not, write to the Free Software Foundation, Inc.,
|
25 |
|
|
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
26 |
|
|
##
|
27 |
|
|
## As a special exception, if other files instantiate templates or use
|
28 |
|
|
## macros or inline functions from this file, or you compile this file
|
29 |
|
|
## and link it with other works to produce a work based on this file,
|
30 |
|
|
## this file does not by itself cause the resulting work to be covered by
|
31 |
|
|
## the GNU General Public License. However the source code for this file
|
32 |
|
|
## must still be made available in accordance with section (3) of the GNU
|
33 |
|
|
## General Public License v2.
|
34 |
|
|
##
|
35 |
|
|
## This exception does not invalidate any other reasons why a work based
|
36 |
|
|
## on this file might be covered by the GNU General Public License.
|
37 |
|
|
## -------------------------------------------
|
38 |
|
|
## ####ECOSGPLCOPYRIGHTEND####
|
39 |
|
|
# ====================================================================
|
40 |
|
|
######DESCRIPTIONBEGIN####
|
41 |
|
|
#
|
42 |
|
|
# Author(s): jlarmour
|
43 |
|
|
# Contributors:
|
44 |
|
|
# Date: 2000-06-02
|
45 |
|
|
#
|
46 |
|
|
#####DESCRIPTIONEND####
|
47 |
|
|
#
|
48 |
|
|
# ====================================================================
|
49 |
|
|
|
50 |
|
|
cdl_package CYGPKG_MEMALLOC {
|
51 |
|
|
display "Dynamic memory allocation"
|
52 |
|
|
description "
|
53 |
|
|
This package provides memory allocator infrastructure required for
|
54 |
|
|
dynamic memory allocators, including the ISO standard malloc
|
55 |
|
|
interface. It also contains some sample implementations."
|
56 |
|
|
doc ref/memalloc.html
|
57 |
|
|
include_dir cyg/memalloc
|
58 |
|
|
compile dlmalloc.cxx memfixed.cxx memvar.cxx \
|
59 |
|
|
sepmeta.cxx debug.c
|
60 |
|
|
|
61 |
|
|
# ====================================================================
|
62 |
|
|
|
63 |
|
|
cdl_component CYGPKG_MEMALLOC_ALLOCATORS {
|
64 |
|
|
display "Memory allocator implementations"
|
65 |
|
|
flavor none
|
66 |
|
|
no_define
|
67 |
|
|
description "
|
68 |
|
|
This component contains configuration options related to the
|
69 |
|
|
various memory allocators available."
|
70 |
|
|
|
71 |
|
|
cdl_component CYGPKG_MEMALLOC_ALLOCATOR_FIXED {
|
72 |
|
|
display "Fixed block allocator"
|
73 |
|
|
flavor none
|
74 |
|
|
no_define
|
75 |
|
|
description "
|
76 |
|
|
This component contains configuration options related to the
|
77 |
|
|
fixed block memory allocator."
|
78 |
|
|
|
79 |
|
|
cdl_option CYGSEM_MEMALLOC_ALLOCATOR_FIXED_THREADAWARE {
|
80 |
|
|
display "Make thread safe"
|
81 |
|
|
active_if CYGPKG_KERNEL
|
82 |
|
|
default_value 1
|
83 |
|
|
description "
|
84 |
|
|
With this option enabled, this allocator will be
|
85 |
|
|
made thread-safe. Additionally allocation functions
|
86 |
|
|
are made available that allow a thread to wait
|
87 |
|
|
until memory is available."
|
88 |
|
|
}
|
89 |
|
|
}
|
90 |
|
|
|
91 |
|
|
cdl_component CYGPKG_MEMALLOC_ALLOCATOR_VARIABLE {
|
92 |
|
|
display "Simple variable block allocator"
|
93 |
|
|
flavor none
|
94 |
|
|
no_define
|
95 |
|
|
description "
|
96 |
|
|
This component contains configuration options related to the
|
97 |
|
|
simple variable block memory allocator. This allocator is not
|
98 |
|
|
very fast, and in particular does not scale well with large
|
99 |
|
|
numbers of allocations. It is however very compact in terms of
|
100 |
|
|
code size and does not have very much overhead per allocation."
|
101 |
|
|
|
102 |
|
|
cdl_option CYGSEM_MEMALLOC_ALLOCATOR_VARIABLE_THREADAWARE {
|
103 |
|
|
display "Make thread safe"
|
104 |
|
|
active_if CYGPKG_KERNEL
|
105 |
|
|
default_value 1
|
106 |
|
|
description "
|
107 |
|
|
With this option enabled, this allocator will be
|
108 |
|
|
made thread-safe. Additionally allocation functions
|
109 |
|
|
are added that allow a thread to wait until memory
|
110 |
|
|
are made available that allow a thread to wait
|
111 |
|
|
until memory is available."
|
112 |
|
|
}
|
113 |
|
|
|
114 |
|
|
cdl_option CYGSEM_MEMALLOC_ALLOCATOR_VARIABLE_COALESCE {
|
115 |
|
|
display "Coalesce memory"
|
116 |
|
|
default_value 1
|
117 |
|
|
description "
|
118 |
|
|
The variable-block memory allocator can perform coalescing
|
119 |
|
|
of memory whenever the application code releases memory back
|
120 |
|
|
to the pool. This coalescing reduces the possibility of
|
121 |
|
|
memory fragmentation problems, but involves extra code and
|
122 |
|
|
processor cycles."
|
123 |
|
|
}
|
124 |
|
|
}
|
125 |
|
|
|
126 |
|
|
cdl_component CYGPKG_MEMALLOC_ALLOCATOR_DLMALLOC {
|
127 |
|
|
display "Doug Lea's malloc"
|
128 |
|
|
flavor none
|
129 |
|
|
description "
|
130 |
|
|
This component contains configuration options related to the
|
131 |
|
|
port of Doug Lea's memory allocator, normally known as
|
132 |
|
|
dlmalloc. dlmalloc has a reputation for being both fast
|
133 |
|
|
and space-conserving, as well as resisting fragmentation well.
|
134 |
|
|
It is a common choice for a general purpose allocator and
|
135 |
|
|
has been used in both newlib and Linux glibc."
|
136 |
|
|
|
137 |
|
|
cdl_option CYGDBG_MEMALLOC_ALLOCATOR_DLMALLOC_DEBUG {
|
138 |
|
|
display "Debug build"
|
139 |
|
|
requires CYGDBG_USE_ASSERTS
|
140 |
|
|
default_value { 0 != CYGDBG_USE_ASSERTS }
|
141 |
|
|
description "
|
142 |
|
|
Doug Lea's malloc implementation has substantial amounts
|
143 |
|
|
of internal checking in order to verify the operation
|
144 |
|
|
and consistency of the allocator. However this imposes
|
145 |
|
|
substantial overhead on each operation. Therefore this
|
146 |
|
|
checking may be individually disabled."
|
147 |
|
|
}
|
148 |
|
|
|
149 |
|
|
cdl_option CYGIMP_MEMALLOC_ALLOCATOR_DLMALLOC_THREADAWARE {
|
150 |
|
|
display "Make thread safe"
|
151 |
|
|
active_if CYGPKG_KERNEL
|
152 |
|
|
requires CYGPKG_KERNEL
|
153 |
|
|
default_value 1
|
154 |
|
|
description "
|
155 |
|
|
With this option enabled, this allocator will be
|
156 |
|
|
made thread-safe. Additionally allocation functions
|
157 |
|
|
are made available that allow a thread to wait
|
158 |
|
|
until memory is available."
|
159 |
|
|
}
|
160 |
|
|
|
161 |
|
|
cdl_option CYGIMP_MEMALLOC_ALLOCATOR_DLMALLOC_SAFE_MULTIPLE {
|
162 |
|
|
display "Support more than one instance"
|
163 |
|
|
default_value 1
|
164 |
|
|
description "
|
165 |
|
|
Having this option disabled allows important
|
166 |
|
|
implementation structures to be declared as a single
|
167 |
|
|
static instance, allowing faster access. However this
|
168 |
|
|
would fail if there is more than one instance of
|
169 |
|
|
the dlmalloc allocator class. Therefore this option can
|
170 |
|
|
be enabled if multiple instances are required. Note: as
|
171 |
|
|
a special case, if this allocator is used as the
|
172 |
|
|
implementation of malloc, and it can be determined there
|
173 |
|
|
is more than one malloc pool, then this option will be
|
174 |
|
|
silently enabled."
|
175 |
|
|
}
|
176 |
|
|
|
177 |
|
|
cdl_option CYGIMP_MEMALLOC_ALLOCATOR_DLMALLOC_USE_MEMCPY {
|
178 |
|
|
display "Use system memmove() and memset()"
|
179 |
|
|
requires CYGPKG_ISOINFRA
|
180 |
|
|
requires CYGINT_ISO_STRING_MEMFUNCS
|
181 |
|
|
default_value { (0 != CYGPKG_ISOINFRA) && (0 != CYGINT_ISO_STRING_MEMFUNCS) }
|
182 |
|
|
description "
|
183 |
|
|
This may be used to control whether memset() and memmove()
|
184 |
|
|
are used within the implementation. The alternative is
|
185 |
|
|
to use some macro equivalents, which have been reported
|
186 |
|
|
to be faster in some circumstances. The use of \"MEMCPY\"
|
187 |
|
|
in the CDL option name is an anachronism and only
|
188 |
|
|
present for backwards compatibility."
|
189 |
|
|
}
|
190 |
|
|
|
191 |
|
|
cdl_option CYGNUM_MEMALLOC_ALLOCATOR_DLMALLOC_ALIGNMENT {
|
192 |
|
|
display "Minimum alignment of allocated blocks"
|
193 |
|
|
flavor data
|
194 |
|
|
legal_values 3 to 10
|
195 |
|
|
default_value 3
|
196 |
|
|
description "
|
197 |
|
|
This option controls the minimum alignment that the
|
198 |
|
|
allocated memory blocks are aligned on, specified as
|
199 |
|
|
2^N. Note that using large mininum alignments can lead
|
200 |
|
|
to excessive memory wastage."
|
201 |
|
|
}
|
202 |
|
|
}
|
203 |
|
|
|
204 |
|
|
cdl_component CYGPKG_MEMALLOC_ALLOCATOR_SEPMETA {
|
205 |
|
|
display "Variable block allocator with separate metadata"
|
206 |
|
|
flavor none
|
207 |
|
|
no_define
|
208 |
|
|
description "
|
209 |
|
|
This component contains configuration options related to the
|
210 |
|
|
variable block memory allocator with separate metadata."
|
211 |
|
|
|
212 |
|
|
cdl_option CYGSEM_MEMALLOC_ALLOCATOR_SEPMETA_THREADAWARE {
|
213 |
|
|
display "Make thread safe"
|
214 |
|
|
active_if CYGPKG_KERNEL
|
215 |
|
|
default_value 1
|
216 |
|
|
description "
|
217 |
|
|
With this option enabled, this allocator will be
|
218 |
|
|
made thread-safe. Additionally allocation functions
|
219 |
|
|
are made available that allow a thread to wait
|
220 |
|
|
until memory is available."
|
221 |
|
|
}
|
222 |
|
|
}
|
223 |
|
|
}
|
224 |
|
|
|
225 |
|
|
cdl_option CYGFUN_MEMALLOC_KAPI {
|
226 |
|
|
display "Kernel C API support for memory allocation"
|
227 |
|
|
active_if CYGPKG_KERNEL
|
228 |
|
|
default_value CYGFUN_KERNEL_API_C
|
229 |
|
|
description "
|
230 |
|
|
This option must be enabled to provide the extensions required
|
231 |
|
|
to support integration into the kernel C API."
|
232 |
|
|
compile kapi.cxx
|
233 |
|
|
}
|
234 |
|
|
|
235 |
|
|
cdl_option CYGSEM_MEMALLOC_MALLOC_ZERO_RETURNS_NULL {
|
236 |
|
|
display "malloc(0) returns NULL"
|
237 |
|
|
default_value 0
|
238 |
|
|
description "
|
239 |
|
|
This option controls the behavior of malloc(0) ( or calloc with
|
240 |
|
|
either argument 0 ). It is permitted by the standard to return
|
241 |
|
|
either a NULL pointer or a unique pointer. Enabling this option
|
242 |
|
|
forces a NULL pointer to be returned."
|
243 |
|
|
}
|
244 |
|
|
|
245 |
|
|
cdl_option CYGSEM_MEMALLOC_INVOKE_OUT_OF_MEMORY {
|
246 |
|
|
display "Breakpoint site when running out of memory"
|
247 |
|
|
default_value 0
|
248 |
|
|
description "
|
249 |
|
|
Whenever the system runs out of memory, it invokes this function
|
250 |
|
|
before either going to sleep waiting for memory to become
|
251 |
|
|
available or returning failure."
|
252 |
|
|
}
|
253 |
|
|
|
254 |
|
|
cdl_component CYGPKG_MEMALLOC_MALLOC_ALLOCATORS {
|
255 |
|
|
display "malloc() and supporting allocators"
|
256 |
|
|
flavor bool
|
257 |
|
|
active_if CYGPKG_ISOINFRA
|
258 |
|
|
implements CYGINT_ISO_MALLOC
|
259 |
|
|
implements CYGINT_ISO_MALLINFO
|
260 |
|
|
default_value 1
|
261 |
|
|
compile malloc.cxx
|
262 |
|
|
description "
|
263 |
|
|
This component enables support for dynamic memory
|
264 |
|
|
allocation as supplied by the functions malloc(),
|
265 |
|
|
free(), calloc() and realloc(). As these
|
266 |
|
|
functions are often used, but can have quite an
|
267 |
|
|
overhead, disabling them here can ensure they
|
268 |
|
|
cannot even be used accidentally when static
|
269 |
|
|
allocation is preferred. Within this component are
|
270 |
|
|
various allocators that can be selected for use
|
271 |
|
|
as the underlying implementation of the dynamic
|
272 |
|
|
allocation functions."
|
273 |
|
|
|
274 |
|
|
make -priority 50 {
|
275 |
|
|
heapgeninc.tcl : /src/heapgen.cpp
|
276 |
|
|
$(CC) $(ACTUAL_CXXFLAGS) $(INCLUDE_PATH) -Wp,-MD,heapgen.tmp -E $< -o $@
|
277 |
|
|
@sed -e '/^ *\\/d' -e "s#.*: #$@: #" heapgen.tmp > $(notdir $@).deps
|
278 |
|
|
@rm heapgen.tmp
|
279 |
|
|
}
|
280 |
|
|
|
281 |
|
|
# FIXME this should have a dependency on mlt_headers, but CDL doesn't
|
282 |
|
|
# permit custom build rules depending on phony targets
|
283 |
|
|
make -priority 50 {
|
284 |
|
|
heaps.cxx : /src/heapgen.tcl heapgeninc.tcl
|
285 |
|
|
tclsh $< "$(PREFIX)" "`pwd`"
|
286 |
|
|
@cp heaps.hxx "$(PREFIX)"/include/pkgconf/heaps.hxx
|
287 |
|
|
@chmod u+w "$(PREFIX)"/include/pkgconf/heaps.hxx
|
288 |
|
|
}
|
289 |
|
|
|
290 |
|
|
make_object {
|
291 |
|
|
heaps.o.d : heaps.cxx
|
292 |
|
|
$(CC) $(ACTUAL_CXXFLAGS) $(INCLUDE_PATH) -Wp,-MD,heaps.tmp -c -o $(OBJECT_PREFIX)_$(notdir $(@:.o.d=.o)) $<
|
293 |
|
|
@sed -e '/^ *\\/d' -e "s#.*: #$@: #" heaps.tmp > $@
|
294 |
|
|
@rm heaps.tmp
|
295 |
|
|
}
|
296 |
|
|
|
297 |
|
|
cdl_component CYGBLD_MEMALLOC_MALLOC_EXTERNAL_HEAP_H {
|
298 |
|
|
display "Use external heap definition"
|
299 |
|
|
flavor booldata
|
300 |
|
|
default_value 0
|
301 |
|
|
description "This option allows other components in the
|
302 |
|
|
system to override the default system
|
303 |
|
|
provision of heap memory pools. This should
|
304 |
|
|
be set to a header which provides the equivalent
|
305 |
|
|
definitions to ."
|
306 |
|
|
}
|
307 |
|
|
|
308 |
|
|
cdl_component CYGBLD_MEMALLOC_MALLOC_EXTERNAL_JOIN_H {
|
309 |
|
|
display "Use external implementation of joining multiple heaps"
|
310 |
|
|
flavor booldata
|
311 |
|
|
default_value 0
|
312 |
|
|
description "The default implementation of joining multiple heaps
|
313 |
|
|
is fine for the case where there are multiple disjoint
|
314 |
|
|
memory regions of the same type. However, in a system
|
315 |
|
|
there might be e.g. a small amount of internal SRAM and
|
316 |
|
|
a large amount of external DRAM. The SRAM is faster and
|
317 |
|
|
the DRAM is slower. An application can implement some
|
318 |
|
|
heuristic to choose which pool to allocate from. This
|
319 |
|
|
heuristic can be highly application specific."
|
320 |
|
|
}
|
321 |
|
|
|
322 |
|
|
cdl_interface CYGINT_MEMALLOC_MALLOC_ALLOCATORS {
|
323 |
|
|
display "malloc() allocator implementations"
|
324 |
|
|
requires { CYGINT_MEMALLOC_MALLOC_ALLOCATORS == 1 }
|
325 |
|
|
no_define
|
326 |
|
|
}
|
327 |
|
|
|
328 |
|
|
cdl_option CYGBLD_MEMALLOC_MALLOC_IMPLEMENTATION_HEADER {
|
329 |
|
|
display "malloc() implementation instantiation data"
|
330 |
|
|
flavor data
|
331 |
|
|
description "
|
332 |
|
|
Memory allocator implementations that are capable of being
|
333 |
|
|
used underneath malloc() must be instantiated. The code
|
334 |
|
|
to do this is set in this option. It is only intended to
|
335 |
|
|
be set by the implementation, not the user."
|
336 |
|
|
# default corresponds to the default allocator
|
337 |
|
|
default_value {""}
|
338 |
|
|
}
|
339 |
|
|
|
340 |
|
|
cdl_option CYGIMP_MEMALLOC_MALLOC_VARIABLE_SIMPLE {
|
341 |
|
|
display "Simple variable block implementation"
|
342 |
|
|
description "This causes malloc() to use the simple
|
343 |
|
|
variable block allocator."
|
344 |
|
|
default_value 0
|
345 |
|
|
implements CYGINT_MEMALLOC_MALLOC_ALLOCATORS
|
346 |
|
|
requires { CYGBLD_MEMALLOC_MALLOC_IMPLEMENTATION_HEADER == \
|
347 |
|
|
"" }
|
348 |
|
|
requires CYGSEM_MEMALLOC_ALLOCATOR_VARIABLE_COALESCE
|
349 |
|
|
}
|
350 |
|
|
|
351 |
|
|
cdl_option CYGIMP_MEMALLOC_MALLOC_DLMALLOC {
|
352 |
|
|
display "Doug Lea's malloc implementation"
|
353 |
|
|
description "This causes malloc() to use a version of Doug Lea's
|
354 |
|
|
malloc (dlmalloc) as the underlying implementation."
|
355 |
|
|
default_value 1
|
356 |
|
|
implements CYGINT_MEMALLOC_MALLOC_ALLOCATORS
|
357 |
|
|
requires { CYGBLD_MEMALLOC_MALLOC_IMPLEMENTATION_HEADER == \
|
358 |
|
|
"" }
|
359 |
|
|
}
|
360 |
|
|
}
|
361 |
|
|
cdl_option CYGNUM_MEMALLOC_FALLBACK_MALLOC_POOL_SIZE {
|
362 |
|
|
display "Size of the fallback dynamic memory pool in bytes"
|
363 |
|
|
flavor data
|
364 |
|
|
legal_values 32 to 0x7fffffff
|
365 |
|
|
default_value 16384
|
366 |
|
|
description "
|
367 |
|
|
If *no* heaps are configured in your memory layout,
|
368 |
|
|
dynamic memory allocation by
|
369 |
|
|
malloc() and calloc() must be from a fixed-size,
|
370 |
|
|
contiguous memory pool (note here that it is the
|
371 |
|
|
pool that is of a fixed size, but malloc() is still
|
372 |
|
|
able to allocate variable sized chunks of memory
|
373 |
|
|
from it). This option is the size
|
374 |
|
|
of that pool, in bytes. Note that not all of
|
375 |
|
|
this is available for programs to
|
376 |
|
|
use - some is needed for internal information
|
377 |
|
|
about memory regions, and some may be lost to
|
378 |
|
|
ensure that memory allocation only returns
|
379 |
|
|
memory aligned on word (or double word)
|
380 |
|
|
boundaries - a very common architecture
|
381 |
|
|
constraint."
|
382 |
|
|
}
|
383 |
|
|
# ====================================================================
|
384 |
|
|
|
385 |
|
|
cdl_component CYGPKG_MEMALLOC_OPTIONS {
|
386 |
|
|
display "Common memory allocator package build options"
|
387 |
|
|
flavor none
|
388 |
|
|
no_define
|
389 |
|
|
description "
|
390 |
|
|
Package specific build options including control over
|
391 |
|
|
compiler flags used only in building this package,
|
392 |
|
|
and details of which tests are built."
|
393 |
|
|
|
394 |
|
|
cdl_option CYGPKG_MEMALLOC_CFLAGS_ADD {
|
395 |
|
|
display "Additional compiler flags"
|
396 |
|
|
flavor data
|
397 |
|
|
no_define
|
398 |
|
|
default_value { "" }
|
399 |
|
|
description "
|
400 |
|
|
This option modifies the set of compiler flags for
|
401 |
|
|
building this package. These flags are used in addition
|
402 |
|
|
to the set of global flags."
|
403 |
|
|
}
|
404 |
|
|
|
405 |
|
|
cdl_option CYGPKG_MEMALLOC_CFLAGS_REMOVE {
|
406 |
|
|
display "Suppressed compiler flags"
|
407 |
|
|
flavor data
|
408 |
|
|
no_define
|
409 |
|
|
default_value { "" }
|
410 |
|
|
description "
|
411 |
|
|
This option modifies the set of compiler flags for
|
412 |
|
|
building this package. These flags are removed from
|
413 |
|
|
the set of global flags if present."
|
414 |
|
|
}
|
415 |
|
|
|
416 |
|
|
cdl_option CYGPKG_MEMALLOC_TESTS {
|
417 |
|
|
display "Tests"
|
418 |
|
|
flavor data
|
419 |
|
|
no_define
|
420 |
|
|
calculated { "tests/dlmalloc1 tests/dlmalloc2 tests/heaptest tests/kmemfix1 tests/kmemvar1 tests/malloc1 tests/malloc2 tests/malloc3 tests/malloc4 tests/memfix1 tests/memfix2 tests/memvar1 tests/memvar2 tests/realloc tests/sepmeta1 tests/sepmeta2" }
|
421 |
|
|
description "
|
422 |
|
|
This option specifies the set of tests for this package."
|
423 |
|
|
}
|
424 |
|
|
}
|
425 |
|
|
}
|
426 |
|
|
|
427 |
|
|
# ====================================================================
|
428 |
|
|
# EOF memalloc.cdl
|