1 /* 2 This is a version (aka dlmalloc) of malloc/free/realloc written by 3 Doug Lea and released to the public domain. Use, modify, and 4 redistribute this code without permission or acknowledgement in any 5 way you wish. Send questions, comments, complaints, performance 6 data, etc to dl@cs.oswego.edu 7 8 VERSION 2.7.2 Sat Aug 17 09:07:30 2002 Doug Lea (dl at gee) 9 10 Note: There may be an updated version of this malloc obtainable at 11 ftp://gee.cs.oswego.edu/pub/misc/malloc.c 12 Check before installing! 13 14 Hacked up for uClibc by Erik Andersen <andersen@codepoet.org> 15 */ 16 17 #include "malloc.h" 18 19 20 /* ------------------------------ mallopt ------------------------------ */ mallopt(int param_number,int value)21int mallopt(int param_number, int value) 22 { 23 int ret; 24 mstate av; 25 26 ret = 0; 27 28 __MALLOC_LOCK; 29 av = get_malloc_state(); 30 /* Ensure initialization/consolidation */ 31 __malloc_consolidate(av); 32 33 switch(param_number) { 34 case M_MXFAST: 35 if (value >= 0 && value <= MAX_FAST_SIZE) { 36 set_max_fast(av, value); 37 ret = 1; 38 } 39 break; 40 41 case M_TRIM_THRESHOLD: 42 av->trim_threshold = value; 43 ret = 1; 44 break; 45 46 case M_TOP_PAD: 47 av->top_pad = value; 48 ret = 1; 49 break; 50 51 case M_MMAP_THRESHOLD: 52 av->mmap_threshold = value; 53 ret = 1; 54 break; 55 56 case M_MMAP_MAX: 57 av->n_mmaps_max = value; 58 ret = 1; 59 break; 60 } 61 __MALLOC_UNLOCK; 62 return ret; 63 } 64 65