comparison packages/services/memalloc/common/current/src/dlmalloc.cxx @ 159:511f4dc167f6

Merge from eCos master repository on 2001-05-18-01:30:05-BST
author jlarmour
date Fri, 18 May 2001 06:32:28 +0000
parents 6ed91473a1cd
children 0d2b193a635f
comparison
equal deleted inserted replaced
158:f2545e5de153 159:511f4dc167f6
962 correction = (MALLOC_ALIGNMENT) - front_misalign; 962 correction = (MALLOC_ALIGNMENT) - front_misalign;
963 } else { 963 } else {
964 correction = 0; 964 correction = 0;
965 } 965 }
966 966
967 top = (mchunkptr)(base + correction); 967 // too small to be useful?
968 set_head(top, arenasize | PREV_INUSE); 968 if ( correction + 2*MALLOC_ALIGNMENT > (unsigned) size )
969 // help catch errors. Don't fail now.
970 arenabase = NULL;
971 else {
972 top = (mchunkptr)(base + correction);
973 set_head(top, arenasize | PREV_INUSE);
974 }
969 } 975 }
970 976
971 //---------------------------------------------------------------------------- 977 //----------------------------------------------------------------------------
972 978
973 /* Main public routines */ 979 /* Main public routines */
1031 mchunkptr fwd; /* misc temp for linking */ 1037 mchunkptr fwd; /* misc temp for linking */
1032 mchunkptr bck; /* misc temp for linking */ 1038 mchunkptr bck; /* misc temp for linking */
1033 mbinptr q; /* misc temp */ 1039 mbinptr q; /* misc temp */
1034 1040
1035 INTERNAL_SIZE_T nb; 1041 INTERNAL_SIZE_T nb;
1042
1043 /* Allow uninitialised (zero sized) heaps because they could exist as a
1044 * quirk of the MLT setup where a dynamically sized heap is at the top of
1045 * memory. */
1046 if (NULL==arenabase) return NULL;
1036 1047
1037 if ((long)bytes < 0) return 0; 1048 if ((long)bytes < 0) return 0;
1038 1049
1039 nb = request2size(bytes); /* padded request size; */ 1050 nb = request2size(bytes); /* padded request size; */
1040 1051