/[ascend]/trunk/base/generic/utilities/ascMalloc.h
ViewVC logotype

Contents of /trunk/base/generic/utilities/ascMalloc.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 708 - (show annotations) (download) (as text)
Tue Jun 27 07:34:31 2006 UTC (17 years, 11 months ago) by johnpye
File MIME type: text/x-chdr
File size: 21011 byte(s)
Replaced some references to ascmalloc with ASC_NEW_ARRAY
1 /* ASCEND modelling environment
2 Copyright (C) 2006 Carnegie Mellon University
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2, or (at your option)
7 any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place - Suite 330,
17 Boston, MA 02111-1307, USA.
18 *//** @file
19 ASCEND memory allocation & reporting routines.
20
21 These functions provide tracking of memory events and assist
22 finding and debugging memory errors. Memory tracking options are
23 selected using the macros MALLOC_DEBUG and ALLOCATED_TESTS discussed
24 below. This allows the enhanced functionality to be used or turned
25 off as desired. This functionality adds considerable run-time overhead,
26 and so should generally be used for debugging purposes only. There are
27 also routines for reporting on the status of memory blocks as well as
28 for the memory manager itself.<br><br>
29
30 To use the memory tracking features, you need to use the provided
31 allocation and deallocation functions (ascmalloc(), asccalloc(),
32 ascrealloc(), ascfree()). Direct calls to the corresponding system
33 routines will by-pass the memory manager and not be tracked. Memory
34 allocations which return NULL are not tracked or recorded.<br><br>
35
36 This module also standardizes critical implementation-specific features
37 such as behavior when an allocation of zero bytes is requested
38 (see MOD_ASCMALLOC), and the behavior of realloc() under purify
39 (see MOD_REALLOC).<br><br>
40
41 The following macros affect the compilation and run-time behavior
42 of Ascend memory management.
43
44 <pre>
45 MOD_ASCMALLOC Forces the memory allocation functions to always
46 allocate at least 1 byte and return a non-NULL
47 pointer. This macro should be defined if your
48 allocator returns NULL when a zero-sized block is
49 requested (e.g. alpha or rs6000; Borland and Watcom
50 on Windows). It need not be defined if your
51 allocator returns a non-NULL pointer to a zero-length
52 block, saving you a few bytes of memory.
53
54 MALLOC_DEBUG Causes all calls to memory allocation routines
55 to be tracked and logged to an output file.
56 This really slows down the memory management
57 system, and so should be used for debugging only.
58
59 ALLOCATED_TESTS Forces a lot of extra assertions when defined
60 along with MALLOC_DEBUG.
61
62 MOD_REALLOC If defined, ascreallocPURE() uses a homegrown
63 realloc() that behaves properly with purify.
64 This is more expensive, and should be used
65 for debugging only.
66
67 Requires:
68 #include "utilities/ascConfig.h"
69 #include "utilities/ascPanic.h"
70 </pre>
71 *//*
72 by Tom Epperly
73 Created: 2/6/90
74 Version: $Revision: 1.2 $
75 Version control file: $RCSfile: ascMalloc.h,v $
76 Date last modified: $Date: 1997/07/18 11:44:50 $
77 Last modified by: $Author: mthomas $
78 */
79
80 #ifndef ASC_ASCMALLOC_H
81 #define ASC_ASCMALLOC_H
82
83 /* MALLOC_DEBUG may be defined in config.h... */
84 #include <utilities/config.h>
85
86 #ifdef MALLOC_DEBUG
87 # define ascstrdup(str) ascstrdupf_dbg(str)
88 #else
89 # define ascstrdup(str) ascstrdupf(str)
90 #endif
91 /**<
92 * Returns a new copy of string str.
93 * This is the ASCEND rendition of strdup(). The caller is
94 * responsible for deallocating the new string when finished
95 * using ascfree(). Returns NULL if str is NULL or memory
96 * cannot be allocated for the new copy. If MALLOC_DEBUG is
97 * defined, the allocation is tracked.
98 *
99 * @param str The 0-terminated string to copy.
100 * @return A new copy of str as a char *, or NULL if an error occurs.
101 */
102
103 /**
104 Shorthand for creating pointers to newly allocated data of a given type
105 */
106 #define ASC_NEW(TYPE) (TYPE*)ascmalloc(sizeof(TYPE))
107
108 #define ASC_NEW_CLEAR(TYPE) (TYPE*)asccalloc(1,sizeof(TYPE))
109
110 /**
111 Shorthand for creating pointer to an array of newly allocated data of a
112 given type. 'ascmalloc' is used for the allocation.
113 */
114 #define ASC_NEW_ARRAY(TYPE,COUNT) (TYPE*)ascmalloc(sizeof(TYPE)*(COUNT))
115
116 /**
117 Shorthand for creating a pointer to allocated data, using asccalloc (to zero
118 the allocated space).
119 */
120 #define ASC_NEW_ARRAY_CLEAR(TYPE,COUNT) (TYPE*)asccalloc((COUNT),sizeof(TYPE))
121
122 /**
123 Shorthand for creating a pointer to an array of allocated data. If the
124 specified length is zero, no space is allocated, and a NULL is returned
125 instead.
126 */
127 #define ASC_NEW_ARRAY_OR_NULL(TYPE,COUNT) \
128 ((COUNT)>0 ? ASC_NEW_ARRAY(TYPE,COUNT) : NULL)
129
130 #define ASC_NEW_ARRAY_OR_NULL_CLEAR(TYPE,COUNT) \
131 ((COUNT)>0 ? ASC_NEW_ARRAY_CLEAR(TYPE,COUNT) : NULL)
132
133 /* regular expressions for fixing up mallocs (in regexxer)
134 \(([^\*\)]+) ?\*\)\s*ascmalloc\(sizeof\(\1\)\s*\*\s*([a-zA-Z][a-zA-Z_0-9]*)\)
135 \(([^\*\)]+) ?\*\)\s*asccalloc\(([a-zA-Z][a-zA-Z_0-9]*)\s*,\s*sizeof\(\1\)\s*\)
136 */
137
138 #define ASC_FREE(PTR) ascfree(PTR)
139
140 ASC_DLLSPEC(char *) ascstrdupf(CONST char *str);
141 /**<
142 * Implementation function for ascstrdup() if MALLOC_DEBUG
143 * is not defined. Do not call this function directly - use
144 * ascstrdup() instead.
145 */
146
147 ASC_DLLSPEC(char *) ascstrdupf_dbg(CONST char *str);
148 /**<
149 * Implementation function for ascstrdup() if MALLOC_DEBUG
150 * is defined. Do not call this function directly - define
151 * MALLOC_DEBUG and use ascstrdup() instead.
152 */
153
154 ASC_DLLSPEC(char *) asc_memcpy(char *dest, char *src, size_t n);
155 /**<
156 * Copies n bytes from memory address src to dest.
157 * This version of memcpy handles overlapping memory ranges
158 * properly. It could be more efficient internally. As it is,
159 * it moves data a char at a time. Unless n is 0, neither dest
160 * nor src may be NULL (checked by asc_assertion).
161 *
162 * @param dest Pointer to address to which to copy (non-NULL).
163 * @param src Pointer to address from which to copy (non-NULL).
164 * @param n Number of bytes to copy.
165 * @return Returns dest.
166 */
167
168 #ifndef MOD_REALLOC
169 # define ascreallocPURE(ptr,nold,nnew) ascrealloc((ptr),(nnew))
170 #else
171 # ifdef MALLOC_DEBUG
172 # define ascreallocPURE(ptr,nold,nnew) ascreallocPUREF_dbg((ptr),(nold),(nnew))
173 # else
174 # define ascreallocPURE(ptr,nold,nnew) ascreallocPUREF((ptr),(nold),(nnew))
175 # endif
176 #endif
177 /**<
178 * purify realloc() function for debugging purposes.
179 * In some OS, realloc() fools purify into thinking there
180 * is a memory leak. If MOD_REALLOC is defined at compile
181 * time for all software referencing this header, then all
182 * calls to ascreallocPURE() will use a homegrown realloc
183 * that does not fool purify. Leaks of memory reported
184 * around realloc() when MOD_REALLOC is defined should be
185 * real leaks and not OS noise.<br><br>
186 *
187 * The custom function is somewhat more expensive than most
188 * system-supplied realloc()'s, so should only be used for
189 * debugging. Note that ascreallocPURE() will provide memory
190 * event tracking if MALLOC_DEBUG is also defined when this
191 * header is included.
192 *
193 * @see ascreallocPUREF()
194 * @param ptr Pointer to the memory block to reallocate.
195 * @param nold Old block size in bytes.
196 * @param nnew New block size in bytes.
197 * @return A pointer to the new memory block, or NULL if an error occurred.
198 */
199
200 extern char *ascreallocPUREF(char *ptr, size_t oldbytes, size_t newbytes);
201 /**<
202 * Implementation function for release version of ascreallocPURE().
203 * Do not call this function directly - use ascreallocPURE()
204 * (by #defining MOD_REALLOC) instead. This version does not have
205 * its memory tracked. This is a custom realloc() which behaves
206 * properly with purify. It bypasses the standard realloc() function.
207 * The caller must indicate the old size of the memory region.
208 *
209 * @param ptr Pointer to the memory block to reallocate.
210 * @param oldbytes Old block size in bytes.
211 * @param newbytes New block size in bytes.
212 * @return A pointer to the new memory block, or NULL if an error occurred.
213 */
214
215 extern char *ascreallocPUREF_dbg(char *ptr, size_t oldbytes, size_t newbytes);
216 /**<
217 * Implementation function for debug version of ascreallocPURE().
218 * Do not call this function directly - use ascreallocPURE()
219 * (by #defining MOD_REALLOC and MALLOC_DEBUG) instead. This version
220 * has it's allocations tracked by the memory manager. This is
221 * a custom realloc() which behaves properly with purify. It
222 * bypasses the standard realloc() function. The caller must indicate
223 * the old size of the memory region.
224 *
225 * @param ptr Pointer to the memory block to reallocate.
226 * @param oldbytes Old block size in bytes.
227 * @param newbytes New block size in bytes.
228 * @return A pointer to the new memory block, or NULL if an error occurred.
229 */
230
231 #ifdef MALLOC_DEBUG
232 # define ascstatus(msg) ascstatusf(msg)
233 #else
234 # define ascstatus(msg)
235 #endif
236 /**<
237 * Prints a summary of the memory manager status (iff MALLOC_DEBUG
238 * is defined) The msg is first printed, followed by a newline and
239 * then the summary memory report. These are printed both to the
240 * memory log file, as well as to the screen. If MALLOC_DEBUG is
241 * not defined, then nothing is printed.
242 *
243 * @see ascstatus_detail(), ascshutdown()
244 * @param msg The message to print before the summary report.
245 */
246
247 extern void ascstatusf(CONST char *msg);
248 /**<
249 * Implementation function for ascstatus() if MALLOC_DEBUG
250 * is defined. Do not call this function directly - define
251 * MALLOC_DEBUG and use ascstatus() instead.
252 */
253
254 #ifdef MALLOC_DEBUG
255 # define ascstatus_detail(msg) ascstatus_detailf(msg)
256 #else
257 # define ascstatus_detail(msg)
258 #endif
259 /**<
260 * Prints a more detailed report of the memory manager status (iff
261 * MALLOC_DEBUG is defined) The msg is first printed, followed by
262 * a newline and then the memory report. This report includes both
263 * the summary information printed by ascstatus(), as well as a listing
264 * of memory blocks currently allocated. These are printed both to the
265 * memory log file, as well as to the screen. If MALLOC_DEBUG is
266 * not defined, then nothing is printed.
267 *
268 * @see ascstatus(), ascshutdown()
269 * @param msg The message to print before the detail report.
270 */
271
272 extern void ascstatus_detailf(CONST char *msg);
273 /**<
274 * Implementation function for ascstatus_detail() if MALLOC_DEBUG
275 * is defined. Do not call this function directly - define
276 * MALLOC_DEBUG and use ascstatus_detail() instead.
277 */
278
279 #ifdef MALLOC_DEBUG
280 # define ascshutdown(msg) ascshutdownf(msg)
281 #else
282 # define ascshutdown(msg)
283 #endif
284 /**<
285 * Prints a detailed report of the memory manager status and cleans
286 * up after memory logging (iff MALLOC_DEBUG is defined). The
287 * reporting is the same as ascstatus_detail(). After this function
288 * is called, subsequent allocation/deallocation activity will be
289 * logged in a different log file than previously. If MALLOC_DEBUG
290 * is not defined, then this function does nothing.
291 *
292 * @see ascstatus(), ascstatus_detail()
293 * @param msg The message to print before the detail report.
294 */
295
296 ASC_DLLSPEC(void) ascshutdownf(CONST char *msg);
297 /**<
298 * Implementation function for ascshutdown() if MALLOC_DEBUG
299 * is defined. Do not call this function directly - define
300 * MALLOC_DEBUG and use ascshutdown() instead.
301 */
302
303 #ifdef MALLOC_DEBUG
304 # define ascmeminuse() ascmeminusef()
305 #else
306 # define ascmeminuse() (0)
307 #endif
308
309 ASC_DLLSPEC(unsigned long) ascmeminusef(void);
310 /**<
311 * Returns the current total amount of allocated memory (iff
312 * MALLOC_DEBUG is #defined). If MALLOC_DEBUG is not #defined,
313 * the return value is 0 regardless of the actual amount of
314 * allocated memory.
315 */
316
317 #ifdef MOD_ASCMALLOC
318 # define AT_LEAST_1(x) MAX((x),1)
319 #else
320 # define AT_LEAST_1(x) (x)
321 #endif
322 /**<
323 * Macro to ensure at least 1 byte is requested when MOD_ASCMALLOC
324 * is defined. Requires a define for MAX(), which is located in
325 * utilities/ascConfig.h.
326 */
327
328 #ifdef MALLOC_DEBUG
329 # define asccalloc(nelem, size) \
330 asccallocf(AT_LEAST_1(nelem), (size), __FILE__, __LINE__)
331 #else
332 # define asccalloc(nelem,size) calloc(AT_LEAST_1(nelem),(size))
333 #endif
334 /**<
335 * ASCEND calloc() function.
336 * If MALLOC_DEBUG is defined, the allocation is tracked.
337 * If not, then the standard system calloc() is used.
338 *
339 * @see asccallocf()
340 * @param nelem size_t, number of elements to allocate.
341 * @param size size_t, size of each element.
342 * @return A (void *) to the newly-allocated block, or NULL on error.
343 */
344
345 ASC_DLLSPEC(VOIDPTR) asccallocf(size_t nelem, size_t elsize,
346 CONST char *file, int line);
347 /**<
348 * Implementation function for asccalloc() when MALLOC_DEBUG
349 * is defined. Do not call this function directly - use
350 * asccalloc() instead.
351 */
352
353 #ifdef MALLOC_DEBUG
354 # define ascmalloc(size) \
355 ascmallocf(AT_LEAST_1(size), __FILE__, __LINE__)
356 #else
357 # define ascmalloc(size) malloc(AT_LEAST_1(size))
358 #endif
359 /**<
360 * ASCEND malloc() function.
361 * If MALLOC_DEBUG is defined, the allocation is tracked.
362 * If not, then the standard system malloc() is used.
363 *
364 * @see ascmallocf()
365 * @param size size_t, size of each element.
366 * @return A (void *) to the newly-allocated block, or NULL on error.
367 */
368
369 ASC_DLLSPEC(VOIDPTR) ascmallocf(size_t size, CONST char * file, int line);
370 /**<
371 * Implementation function for ascmalloc() when MALLOC_DEBUG
372 * is defined. Do not call this function directly - define
373 * MALLOC_DEBUG and use ascmalloc() instead.
374 */
375
376 #ifdef MALLOC_DEBUG
377 # define ascrealloc(ptr, size) \
378 ascreallocf((ptr), AT_LEAST_1(size), __FILE__, __LINE__)
379 #else
380 # if (defined(sun) && !defined(__SVR4))
381 # define ascrealloc(ptr,size) \
382 ((ptr)!=NULL ? realloc((ptr), AT_LEAST_1(size)) : malloc(AT_LEAST_1(size)))
383 # else
384 # define ascrealloc(ptr,size) realloc((ptr), AT_LEAST_1(size))
385 # endif
386 #endif
387 /**<
388 * ASCEND realloc() function.
389 * If MALLOC_DEBUG is defined, the allocation is tracked.
390 * If not, then the standard system realloc() is used.
391 *
392 * @see ascreallocf(), ascreallocPURE()
393 * @param ptr Pointer to memory block to reallocate.
394 * @param size size_t, size of each element.
395 * @return A (void *) to the newly-allocated block, or NULL on error.
396 */
397
398 ASC_DLLSPEC(VOIDPTR) ascreallocf(VOIDPTR ptr, size_t size,
399 CONST char *file, int line);
400 /**<
401 * Implementation function for ascrealloc() when MALLOC_DEBUG
402 * is defined. Do not call this function directly - define
403 * MALLOC_DEBUG and use ascrealloc() instead.
404 */
405
406 #ifdef MALLOC_DEBUG
407 # define ascfree(ptr) ascfreef((ptr), __FILE__, __LINE__)
408 #else
409 # define ascfree(ptr) free(ptr)
410 #endif
411 /**<
412 * ASCEND free() function.
413 * If MALLOC_DEBUG is defined, the deallocation is tracked.
414 * If not, then the standard system free() is used.
415 *
416 * @see ascfreef()
417 * @param ptr Pointer to the memory block to free.
418 */
419
420 ASC_DLLSPEC(void) ascfreef(VOIDPTR ptr, CONST char *file, int line);
421 /**<
422 * Implementation function for ascfree() when MALLOC_DEBUG
423 * is defined. Do not call this function directly - define
424 * MALLOC_DEBUG and use ascfree() instead.
425 */
426
427 #ifdef MALLOC_DEBUG
428 # define ascbcopy(src,dest,size) \
429 ascbcopyf((src), (dest), (size), __FILE__, __LINE__)
430 #else
431 # define ascbcopy(src,dest,size) \
432 memcpy((void *)(dest), (void *)(src), (size))
433 #endif
434 /**<
435 * ASCEND bcopy() function.
436 * Copies size bytes from src to dest. If MALLOC_DEBUG is
437 * defined, this uses custom function ascbcopyf(). If not,
438 * then memcpy() is used.
439 *
440 * @see asc_memcpy(), ascbcopyf(), ascbzero(), ascbfill()
441 * @param src Pointer to memory block to copy.
442 * @param dest Pointer to memory block to receive copy.
443 * @param size size_t, number of bytes to copy.
444 * @return A (void *) to dest.
445 */
446
447 ASC_DLLSPEC(VOIDPTR) ascbcopyf(CONST VOIDPTR src, VOIDPTR dest, size_t size,
448 CONST char *file, int line);
449 /**<
450 * Implementation function for ascbcopy() when MALLOC_DEBUG
451 * is defined. Do not call this function directly - define
452 * MALLOC_DEBUG and use ascbcopy() instead.
453 */
454
455 #ifdef MALLOC_DEBUG
456 # define ascbzero(dest,length) \
457 ascbzerof((dest), (length), __FILE__, __LINE__)
458 #else
459 # define ascbzero(dest,length) memset((char *)(dest), 0, (length))
460 #endif
461 /**<
462 * ASCEND bzero() function.
463 * Sets length bytes of memory at dest to zero. If MALLOC_DEBUG
464 * is defined, this uses custom function ascbzerof(). If not,
465 * then memset() is used.
466 *
467 * @see ascbzerof(), ascbcopy(), ascbfill()
468 * @param dest Pointer to memory block to be cleared.
469 * @param length size_t, number of bytes to set to zero.
470 * @return A (void *) to dest.
471 */
472
473 ASC_DLLSPEC(VOIDPTR) ascbzerof(VOIDPTR dest, size_t length, CONST char *file, int line);
474 /**<
475 * Implementation function for ascbzero() when MALLOC_DEBUG
476 * is defined. Do not call this function directly - define
477 * MALLOC_DEBUG and use ascbzero() instead.
478 */
479
480 #ifdef MALLOC_DEBUG
481 # define AllocatedMemory(ptr,size) AllocatedMemoryF((ptr), (size))
482 #else
483 # define AllocatedMemory(ptr,size) (1)
484 #endif
485 /**<
486 * Evaluate a memory block for allocation status.
487 * Return values if MALLOC is defined:
488 * - 0 no memory in the block is currently allocated
489 * - 1 the memory block is wholly contained in an allocated block
490 * - 2 the memory block equals an element of the memory list
491 * - -1 the memory block is partially contained in an allocated block
492 * If MALLOC_DEBUG is not defined, always returns 1.
493 *
494 * @param ptr Pointer to memory block to look up
495 * @param size size_t, size of the memory block to look up.
496 */
497
498 ASC_DLLSPEC(int) AllocatedMemoryF(CONST VOIDPTR ptr, size_t size);
499 /**<
500 * Implementation function for AllocatedMemory() when
501 * MALLOC_DEBUG is defined. Do not call this function
502 * directly - define MALLOC_DEBUG and use
503 * AllocatedMemory() instead.
504 */
505
506 #ifdef MALLOC_DEBUG
507 # define InMemoryBlock(ptr1,ptr2) InMemoryBlockF((ptr1), (ptr2))
508 #else
509 #define InMemoryBlock(ptr1,ptr2) (1)
510 #endif
511 /**<
512 * Query whether one memory block is contained within another.
513 * Returns non-zero if ptr2 is in the memory block starting at
514 * address ptr1; otherwise returns 0. If MALLOC_DEBUG is not
515 * defined, always returns 1.
516 */
517
518 ASC_DLLSPEC(int) InMemoryBlockF(CONST VOIDPTR ptr1, CONST VOIDPTR ptr2);
519 /**<
520 * Implementation function for InMemoryBlock() when MALLOC_DEBUG
521 * is defined. Do not call this function directly - define
522 * MALLOC_DEBUG and use InMemoryBlock() instead.
523 */
524
525 #define ascbfill(dest,length) memset((char *)(dest), 255, (length))
526 /**<
527 * Sets length bytes of memory at dest to 255. There is
528 * no difference in implementation whether MALLOC_DEBUG is
529 * defined or not.
530 *
531 * @see ascbcopy(), ascbzero()
532 * @param dest Pointer to memory block to be set.
533 * @param length size_t, number of bytes to set to 255.
534 * @return A (void *) to dest.
535 */
536
537 #if defined(MALLOC_DEBUG) && defined(ALLOCATED_TESTS)
538 # define AssertAllocatedMemory(ptr,size) \
539 asc_assert(AllocatedMemoryF((VOIDPTR)(ptr), (size_t)(AT_LEAST_1(size)))==2)
540 #else
541 # define AssertAllocatedMemory(ptr,size)
542 #endif
543 /**<
544 * Assertion that a memory block is allocated with specified size.
545 * This assertion is only active if both MALLOC_DEBUG
546 * and ALLOCATED_TESTS are defined.
547 *
548 * @param ptr Pointer to memory block to evaluate.
549 * @param size size_t, size of memory block to evaluate.
550 */
551
552 #if defined(MALLOC_DEBUG) && defined(ALLOCATED_TESTS)
553 # define AssertMemory(ptr) \
554 asc_assert(AllocatedMemoryF((VOIDPTR)(ptr), 0))
555 #else
556 # define AssertMemory(ptr)
557 #endif
558 /**<
559 * Assertion that ptr points to (or into) an allocated memory
560 * block. This assertion is only active if both MALLOC_DEBUG
561 * and ALLOCATED_TESTS are defined.
562 *
563 * @param ptr Pointer to memory block to evaluate.
564 */
565
566 #if defined(MALLOC_DEBUG) && defined(ALLOCATED_TESTS)
567 # define AssertContainedMemory(ptr,size) \
568 asc_assert(AllocatedMemoryF((VOIDPTR)(ptr),(size_t)(size))>0)
569 #else
570 # define AssertContainedMemory(ptr,size)
571 #endif
572 /**<
573 * Assertion that a memory block is wholly or partially
574 * contained in an allocated block.
575 * This assertion is only active if both MALLOC_DEBUG
576 * and ALLOCATED_TESTS are defined.
577 *
578 * @param ptr Pointer to memory block to evaluate.
579 * @param size size_t, size of memory block to evaluate.
580 */
581
582 #if defined(MALLOC_DEBUG) && defined(ALLOCATED_TESTS)
583 # define AssertContainedIn(ptr1,ptr2) \
584 asc_assert(InMemoryBlockF((VOIDPTR)(ptr1),(VOIDPTR)(ptr2)))
585 #else
586 # define AssertContainedIn(ptr,ptr2)
587 #endif
588 /**<
589 * Assertion that memory block ptr2 is contained in the block
590 * starting at ptr1. This assertion is only active if both
591 * MALLOC_DEBUG and ALLOCATED_TESTS are defined.
592 */
593
594 #endif /* ASC_ASCMALLOC_H */
595

john.pye@anu.edu.au
ViewVC Help
Powered by ViewVC 1.1.22