summaryrefslogtreecommitdiffstats
path: root/libc/stdlib/malloc/malloc.h
Commit message (Collapse)AuthorAgeFilesLines
* nptl: fix malloc library lockingTimo Teräs2010-04-221-6/+5
| | | | | | | | Update malloc library to use internal uclibc locking primitives to get the libpthread calls correct. Signed-off-by: Timo Teräs <timo.teras@iki.fi> Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
* - revert 24148:24151Bernhard Reutner-Fischer2008-11-261-8/+10
|
* - remove some bloat that was added in r23660 and subsequent r23698.Bernhard Reutner-Fischer2008-11-251-10/+8
| | | | The sbrk lock is only needed for LT.old
* - fix another fallout from r23660Bernhard Reutner-Fischer2008-10-291-2/+2
|
* This should fix malloc with debug and without threads. (Chase N Douglas)Bernhard Reutner-Fischer2008-10-161-0/+2
| | | | This should have been in r23660. Untested.
* Fix bug 4994 hangs on read(). I have tested the patch extensibly on ARM/LT.old.Khem Raj2008-10-111-1/+5
| | | | | Thank you Chase Douglas for reporting it and for the patch.
* fix up malloc debug buildingMike Frysinger2007-04-131-1/+0
|
* Richard Sandiford writes:Mike Frysinger2007-01-291-5/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | However, retesting on m68k showed up a problem that had appeared in uClibc since the last time I tried. Specifically, revision 15785 did: -#define HEAP_GRANULARITY (sizeof (HEAP_GRANULARITY_TYPE)) +#define HEAP_GRANULARITY (__alignof__ (HEAP_GRANULARITY_TYPE)) -#define MALLOC_ALIGNMENT (sizeof (double)) +#define MALLOC_ALIGNMENT (__alignof__ (double)) The problem is that (a) MALLOC_HEADER_SIZE == MALLOC_ALIGNMENT (b) the header contains a size value of type size_t (c) sizeof (size_t) is 4 on m68k, but... (d) __alignof__ (double) is only 2 (the largest alignment used on m68k) So we only allocate 2 bytes for the 4-byte header, and the least significant 2 bytes of the size are in the user's area rather than the header. The patch below fixes that problem by redefining MALLOC_HEADER_SIZE to: MAX (MALLOC_ALIGNMENT, sizeof (size_t)) (but without the help of the MAX macro ;)). However, we really would like to have word alignment on Coldfire. It makes a big performance difference, and because we have to allocate a 4-byte header anyway, what wastage there is will be confined to the end of the allocated block. Any wastage will also be limited to 2 bytes per allocation compared to the current alignment. I've therefore used the __aligned__ type attribute to create a double type that has at least sizeof (size_t) bytes of alignment. I've introduced a new __attribute_aligned__ macro for this. It might seem silly protecting against old or non-GNU compilers here, but the extra alignment is only an optimisation, and having the macro is more in the spirit of the other attribute code.
* mostly revert the locking changes for 'malloc', as the implementationEric Andersen2006-12-111-4/+5
| | | | | | | | does not easily lend itself to becoming complete pthread cancelation safe without first investing in some deep and serious thought... The other malloc implementations are pthread cancelation safe, and this one is mostly used for uClinux, where the lack is at least less likely to be a common problem.
* Major cleanup of internal mutex locking. Be more consistant in how we doEric Andersen2006-12-071-4/+4
| | | | | | | things, and avoid potential deadlocks caused when a thread holding a uClibc internal lock get canceled and terminates without releasing the lock. This change also provides a single place, bits/uClibc_mutex.h, for thread libraries to modify to change all instances of internal locking.
* merge fix from blackfin cvs:Mike Frysinger2006-08-051-1/+1
| | | | bernds writes: Use __alignof__ instead of sizeof to get alignments. Eliminates some warnings about misalignments when malloc debugging is enabled.
* Remove all non-constant libc_hidden_data_def(), it is too unreliable, sorry, ↵Peter S. Mazinger2006-03-101-1/+0
| | | | most of global data relocations are back
* tweak the idea between having a MMU and actually using itMike Frysinger2006-02-181-1/+1
|
* hidden_def/hidden_proto: convert all users (I hope) termios split, add some ↵Peter S. Mazinger2006-01-141-0/+1
| | | | missing headers, other jump relocs removed
* Convert all the rest, remove isxupper/isxlower, if someone objects, I'll add ↵Peter S. Mazinger2005-12-161-0/+2
| | | | it back
* The variable used to store pagesize is not the same as theEric Andersen2004-08-161-1/+2
| | | | | _dl_pagesize variable in ldso, so avoid aliasing. -Erik
* Fixup PAGE_SIZE problemsEric Andersen2004-08-131-3/+2
| | | | -Erik
* s/UCLIBC_HAS_MMU/ARCH_HAS_MMU/gEric Andersen2004-01-161-1/+1
|
* Fix a long-standing bug with pthreads. A couple of linuxthreads filesManuel Novoa III2003-12-271-2/+2
| | | | | | | | | | | | | | | | were including libc-lock.h which had a bunch of weak pragmas. Also, uClibc supplied a number of no-op weak thread functions even though many weren't needed. This combined result was that sometimes the functional versions of thread functions in pthread would not override the weaks in libc. While fixing this, I also prepended double-underscore to all necessary weak thread funcs in uClibc, and removed all unused weaks. I did a test build, but haven't tested this since these changes are a backport from my working tree. I did test the changes there and no longer need to explicitly add -lpthread in the perl build for perl to pass its thread self tests.
* add missing prototypeEric Andersen2003-09-061-0/+2
|
* Debugging tweaks.Miles Bader2002-11-211-1/+4
|
* Improve malloc debugging support.Miles Bader2002-11-211-11/+34
|
* Get rid of old malloc lock stuff.Miles Bader2002-10-151-8/+0
|
* * Add support for uClinux's broken munmap, contingent onMiles Bader2002-10-091-0/+41
| | | | | | | | | __UCLIBC_UCLINUX_BROKEN_MUNMAP__ (which is currently not defined anywhere). This makes other cases a tiny bit less efficient too. * Move the malloc lock into the heap structure (locking is still done at the malloc level though, not by the heap functions). * Initialize the malloc heap to contain a tiny initial static free-area so that programs that only do a very little allocation won't ever call mmap.
* Update debugging hooks.Miles Bader2002-09-061-2/+5
|
* (likely, unlikely): New macros.Miles Bader2002-08-301-6/+8
| | | | (__malloc_likely, __malloc_unlikely): Macros removed.
* (MALLOC_SETUP): New macro.Miles Bader2002-08-191-5/+6
| | | | | (MALLOC_SET_SIZE): Take the base-address of the block, not the user-address. (MALLOC_ADDR): Macro removed.
* (__malloc_likely, __malloc_unlikely): New macros.Miles Bader2002-08-141-0/+10
|
* (MALLOC_REALLOC_MIN_FREE_SIZE): New macro.Miles Bader2002-08-011-2/+8
| | | | Enable debugging if MALLOC_DEBUGGING is defined.
* (MALLOC_HEADER_SIZE): New macro.Miles Bader2002-07-311-2/+6
| | | | (MALLOC_BASE, MALLOC_ADDR): Use it.
* Define MALLOC_SET_SIZE to take the user-address rather than the base-address.Miles Bader2002-07-301-2/+2
|
* Add macros to abstract the malloc header format a bit.Miles Bader2002-07-301-1/+22
|
* Redo the locking, so that it may actually work. Now locking is done atMiles Bader2002-07-251-1/+37
| | | | | | | | | the malloc/free level, not within the heap abstraction, and there's a separate lock to control sbrk access. Also, get rid of the separate `unmap_free_area' function in free.c, and just put the code in the `free' function directly, which saves a bunch of space (even compared to using an inline function) for some reason.
* * Automatically try to unmap heap free-areas when they get very big.Miles Bader2002-07-231-5/+30
| | | | | | | | * Instead of using mmap/munmap directly for large allocations, just use the heap for everything (this is reasonable now that heap memory can be unmapped). * Use sbrk instead of mmap/munmap on systems with an MMU.
* Doc fix.Miles Bader2002-07-191-1/+1
|
* Miles Bader implemented a new mmap based malloc which is muchEric Andersen2002-07-181-0/+45
smarter than the old "malloc-simple", and actually works, unlike the old "malloc". So kill the old "malloc-simple" and the old "malloc" and replace them with Miles' new malloc implementation. Update Config files to match. Thanks Miles!