summaryrefslogtreecommitdiffstats
path: root/libc/stdlib/malloc/malloc.c
Commit message (Collapse)AuthorAgeFilesLines
* malloc: fix race condition and other bugs in the no-mmu mallocFreeman Wang2009-12-191-3/+4
| | | | | | | | | | | | | | Fixes multiple race conditions on mmb list. This was done by making the mmb_heap_lock into a recursive lock and making the regular heap_lock extend to cover the mmb heap handling. Also move the new_mmb allocation up to before the mmb list is iterated through to find the insertion point. When the mmb_heap also runs out and needs to be extended when the regular heap is just extended, the mmb list could be messed up. Signed-off-by: Freeman Wang <xwang@ubicom.com> Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
* nommu: use MAP_UNINITIALIZE for mallocsMike Frysinger2009-11-231-1/+1
| | | | | | | | | Now that the kernel supports MAP_UNINITIALIZE, have the malloc places use it to get real uninitialized memory on no-mmu systems. This avoids a lot of normally useless overhead involved in zeroing out all of the memory (sometimes multiple times). Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* trim Experimentally off and uncommented hiddenBernhard Reutner-Fischer2009-09-181-2/+0
| | | | | | | | sed -i -e '/Experimentally off - /d' $(grep -rl "Experimentally off - " *) sed -i -e '/^\/\*[[:space:]]*libc_hidden_proto(/d' $(grep -rl "libc_hidden_proto" *) should be a nop Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
* - revert 24148:24151Bernhard Reutner-Fischer2008-11-261-4/+4
|
* - remove some bloat that was added in r23660 and subsequent r23698.Bernhard Reutner-Fischer2008-11-251-4/+4
| | | | The sbrk lock is only needed for LT.old
* next portion of libc_hidden_proto removalDenis Vlasenko2008-11-201-2/+2
|
* - fix another fallout from r23660Bernhard Reutner-Fischer2008-10-291-1/+1
|
* Finally fix the MALLOC=y and MALLOC_SIMPLE=y breakage from svn 23660. (I ↵Rob Landley2008-10-281-18/+15
| | | | found it, this is Bernhard's patch to fix it. Tested and it Works For Me (tm)).
* This should fix malloc with debug and without threads. (Chase N Douglas)Bernhard Reutner-Fischer2008-10-161-5/+21
| | | | 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-9/+11
| | | | | Thank you Chase Douglas for reporting it and for the patch.
* Introduce and use small[u]int type. Changes in size:Denis Vlasenko2008-05-201-1/+1
| | | | | | | | | | | | | | - 79 0 28 107 6b libc/inet/rpc/create_xid.o + 76 0 25 101 65 libc/inet/rpc/create_xid.o - 126 0 4 130 82 libc/misc/assert/__assert.o + 123 0 1 124 7c libc/misc/assert/__assert.o - 648 4 24 676 2a4 libc/misc/internals/__uClibc_main.o + 645 4 21 670 29e libc/misc/internals/__uClibc_main.o - 230 0 4 234 ea libc/stdlib/abort.o + 216 0 1 217 d9 libc/stdlib/abort.o - 129 0 4 133 85 libc/termios/tcgetsid.o + 126 0 1 127 7f libc/termios/tcgetsid.o
* fix up malloc debug buildingMike Frysinger2007-04-131-1/+1
|
* POSIX requires that errno be set whenever 0 is returned by malloc()Mike Frysinger2007-04-021-1/+1
|
* 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-3/+3
| | | | missing headers, other jump relocs removed
* __malloc_consolidate is only libc internal, enable use of __sbrkPeter S. Mazinger2005-12-131-0/+1
|
* mmap/mremap/socket/rewind gonePeter S. Mazinger2005-12-081-0/+2
|
* Use MAP_PRIVATE whenever __ARCH_HAS_MMU__ is set.Eric Andersen2004-07-151-1/+6
| | | | Only use MAP_SHARED when mmu-less.
* Don't set errno if for zero SIZE returns.Miles Bader2003-10-161-11/+14
| | | | Code formatting cleanup.
* Fix errno values. Fix MALLOC_GLIBC_COMPAT handling in malloc/malloc.c,Eric Andersen2003-09-061-6/+18
| | | | | which was reversed. Provide more consistancy between implementations. Handle it when people do stupid things like malloc(-1);
* Add in a MALLOC_GLIBC_COMPAT option to let people decide if theyEric Andersen2003-08-081-0/+5
| | | | want glibc style malloc(0) behavior
* Update malloc behavior on malloc(0) to be consistant withEric Andersen2003-01-231-2/+5
| | | | malloc-930716 behavior, i.e. return a NULL.
* Improve malloc debugging support.Miles Bader2002-11-211-12/+19
|
* Don't infinitely recurse when trying to grow __malloc_mmb_heap.Miles Bader2002-10-181-18/+19
|
* Fix locking to not deadlock when __UCLIBC_UCLINUX_BROKEN_MUNMAP__ is defined.Miles Bader2002-10-151-29/+22
|
* * Add support for uClinux's broken munmap, contingent onMiles Bader2002-10-091-18/+68
| | | | | | | | | __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-0/+4
|
* Use `likely' & `unlikely' instead of the `__malloc_'-prefixed versions.Miles Bader2002-08-301-4/+4
|
* (malloc): Use MALLOC_SETUP.Miles Bader2002-08-191-3/+2
|
* Add flow-control hints with __malloc_likely and __malloc_unlikely.Miles Bader2002-08-141-5/+7
|
* Update debugging printfs.Miles Bader2002-07-311-1/+1
|
* Use MALLOC_HEADER_SIZE.Miles Bader2002-07-311-1/+1
|
* MALLOC_SET_SIZE now takes the user-address rather than the base-address.Miles Bader2002-07-301-2/+1
|
* Use new malloc header macros.Miles Bader2002-07-301-3/+4
|
* Size tweaks.Miles Bader2002-07-251-3/+4
|
* Miscellaneous tidying-up.Miles Bader2002-07-251-1/+1
|
* Redo the locking, so that it may actually work. Now locking is done atMiles Bader2002-07-251-8/+41
| | | | | | | | | 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.
* Misc small cleanups.Miles Bader2002-07-241-1/+2
|
* * Automatically try to unmap heap free-areas when they get very big.Miles Bader2002-07-231-60/+50
| | | | | | | | * 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-867/+94
| | | | | | | 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!
* Minor cleanupEric Andersen2001-09-291-1/+2
|
* Update to accomodate the header file changesEric Andersen2001-09-271-1/+1
|
* Fix up breakage resulting from flipping the sense of some defines. Change fromEric Andersen2001-03-191-9/+10
| | | | | | | | defining things to "0" in the disabled case to outright undefining them, lest code that does an "#ifdef FOO" get inadvertantly triggered. Remove now unneeded lines from Rules.mak which makes the command line smaller and avoids redundancy (since this stuff is now pulled in via features.h). -Erik
* Update to "malloc" so it will work on CPUs not supporting non-aligned words.Eric Andersen2001-02-211-7/+35
| | | | malloc still only works for little-endian CPUs... Patch by Jean-Yves Avenard
* Reduce dependancies -- don't use sysconf() internal to libc.Eric Andersen2001-01-151-38/+0
|
* "I will always compile before I commit."Eric Andersen2001-01-121-2/+2
| | | | | | "I will always compile before I commit." "I will always compile before I commit." -Erik
* Patch from James Graves <jgraves@deltamobile.com> to better handle m68k.Eric Andersen2001-01-121-2/+13
| | | | | | Also fixes 2 very important malloc bugs! Anyone using malloc (esp mmu-less) should update and recompile. -Erik
* Manuel Novoa III modified malloc.c and avlmacro.h to reduce code size byEric Andersen2001-01-121-534/+642
| | | | | using functions instead on Inlining (size vas speed tradeoff). I ran the results through indent. Looking pretty good IMHO.
* A bunch of updates, part from Manuel Novoa III (such as more long longEric Andersen2001-01-011-2/+2
| | | | | support), and other updates by me (better cross platform, cross-compiler, etc, support. Now compiles with 2.0.x kernels for armnommu.