summaryrefslogtreecommitdiffstats
path: root/libc/stdlib/malloc
Commit message (Collapse)AuthorAgeFilesLines
* Fix malloc alignmentBernd Schmidt2011-04-112-3/+5
| | | | | | | | | | | | | In commit 3e0a1f388, Richard tried to fix malloc alignments by using alignof (double __attribute_aligned__(sizeof (size_t))). This doesn't work, since attribute_aligned overrides the alignment rather than providing a minimum. On C6X, malloc returns four-byte aligned values rather than the necessary eight-byte alignment. It's simpler to use a comparison and pick the bigger of the two values, so that's what I've done. Signed-off-by: Bernd Schmidt <bernds@codesourcery.com>
* memalign: include sys/param.h for MAXBernhard Reutner-Fischer2011-03-161-2/+1
| | | | | | | | | | | | | libc/stdlib/malloc/memalign.c:22:1: warning: "MAX" redefined In file included from ./libpthread/nptl/sysdeps/unix/sysv/linux/i386/lowlevellock.h:25, from ./include/bits/libc-lock.h:36, from ./include/bits/stdio-lock.h:23, from ./include/bits/uClibc_mutex.h:71, from libc/stdlib/malloc/malloc.h:135, from libc/stdlib/malloc/memalign.c:18: ./include/sys/param.h:75:1: warning: this is the location of the previous definition Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
* nptl: fix malloc library lockingTimo Teräs2010-04-222-10/+8
| | | | | | | | 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>
* prettify make cleanBernhard Reutner-Fischer2010-03-251-2/+2
| | | | Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
* malloc: fix race condition and other bugs in the no-mmu mallocFreeman Wang2009-12-192-6/+7
| | | | | | | | | | | | | | 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>
* malloc: handle size overflows in realloc()Mike Frysinger2009-10-151-0/+3
| | | | | | | | | The malloc() code checks the incoming size to make sure the header adjustment doesn't cause overflow in the size storage. Add the same check to realloc() to catch stupid stuff like realloc(..., -1). Reported-by: James Coleman <james.coleman@ubicom.com> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* trim Experimentally off and uncommented hiddenBernhard Reutner-Fischer2009-09-186-13/+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>
* support building out-of-treeBernhard Reutner-Fischer2009-08-171-0/+2
| | | | | | Handle O= Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
* - revert 24148:24151Bernhard Reutner-Fischer2008-11-263-13/+15
|
* - remove some bloat that was added in r23660 and subsequent r23698.Bernhard Reutner-Fischer2008-11-253-15/+13
| | | | The sbrk lock is only needed for LT.old
* Last portion of libc_hidden_proto removal.Denis Vlasenko2008-11-202-3/+3
| | | | | Appears to build fine (several .configs tried)
* next portion of libc_hidden_proto removalDenis Vlasenko2008-11-204-7/+7
|
* libc_hidden_proto removal, a few more functionsDenis Vlasenko2008-11-181-1/+1
|
* - less verbose make cleanBernhard Reutner-Fischer2008-11-071-4/+4
|
* - fix another fallout from r23660Bernhard Reutner-Fischer2008-10-292-3/+3
|
* Finally fix the MALLOC=y and MALLOC_SIMPLE=y breakage from svn 23660. (I ↵Rob Landley2008-10-288-74/+68
| | | | 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-166-23/+59
| | | | 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-119-74/+56
| | | | | Thank you Chase Douglas for reporting it and for the patch.
* - trim any trailing whitespaceBernhard Reutner-Fischer2008-07-233-3/+3
|
* - fix inline keywordBernhard Reutner-Fischer2008-07-231-5/+5
|
* Introduce and use small[u]int type. Changes in size:Denis Vlasenko2008-05-202-2/+2
| | | | | | | | | | | | | | - 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
* Moving libc_hidden_proto's into #ifdef UCLIBC_INTERNAL blockDenis Vlasenko2008-05-192-2/+2
| | | | | | | | | in string.h and strings.h. This caught unguarded string ops in libc/inet/ethers.c __ether_line_w() function. I will wait for fallout reports for a week or so, then continue converting more libc_hidden_proto's.
* fix from Bernd Schmidt for realloc shrinkage bugMike Frysinger2007-04-241-0/+5
|
* fix up malloc debug buildingMike Frysinger2007-04-1310-13/+14
|
* POSIX requires that errno be set whenever 0 is returned by malloc()Mike Frysinger2007-04-021-1/+1
|
* Richard Sandiford writes:Mike Frysinger2007-01-292-6/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-112-8/+10
| | | | | | | | 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-072-8/+8
| | | | | | | 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-052-2/+2
| | | | 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
* check for a 0 size first, then check for a NULL pointerMike Frysinger2006-02-221-2/+2
|
* tweak the idea between having a MMU and actually using itMike Frysinger2006-02-182-2/+2
|
* libc-{a,so,multi}-y replaced by libc-y covering common objects both in ↵Peter S. Mazinger2006-02-131-14/+11
| | | | libc.a/libc.so, the diffs go into libc-static-y/libc-shared-y exclusively, add IMA to libc, don't use any MSRC anymore
* declare local prototype since we cant use system malloc.hMike Frysinger2006-01-291-0/+1
|
* hidden_def/hidden_proto: convert all users (I hope) termios split, add some ↵Peter S. Mazinger2006-01-147-17/+24
| | | | missing headers, other jump relocs removed
* fix path to heap.h as point out by thomas_chou in Bug 617Mike Frysinger2005-12-301-1/+1
|
* Convert all the rest, remove isxupper/isxlower, if someone objects, I'll add ↵Peter S. Mazinger2005-12-163-4/+6
| | | | it back
* __malloc_consolidate is only libc internal, enable use of __sbrkPeter S. Mazinger2005-12-132-0/+2
|
* Implement hidden poll, switch user to hidden *printf/*scanf/pollPeter S. Mazinger2005-12-092-0/+3
|
* mmap/mremap/socket/rewind gonePeter S. Mazinger2005-12-081-0/+2
|
* Use internal versionsPeter S. Mazinger2005-12-081-0/+2
|
* macro out the thread funcs in libc if threading is disabledMike Frysinger2005-12-061-8/+2
|
* More hiding, 300 leftPeter S. Mazinger2005-12-041-0/+2
|
* More hiding, including __mempcpyPeter S. Mazinger2005-12-031-1/+1
|
* Hide mostly used functionsPeter S. Mazinger2005-12-012-2/+2
|
* Remove TOPDIRPeter S. Mazinger2005-11-211-3/+1
|
* Enable IMAPeter S. Mazinger2005-11-031-2/+1
|
* Remove last unused references to libc-a-pic-, we use only the lists in ↵Peter S. Mazinger2005-11-011-1/+0
| | | | libc-a-y for objects that go into static libs, changing their suffix to .os, of they should be PIC
* Replace all Makefiles for new build infrastucturePeter S. Mazinger2005-10-291-50/+8
|