summaryrefslogtreecommitdiff
path: root/lib/libc/stdlib/malloc.c
AgeCommit message (Collapse)Author
2012-12-30typo in comment, from Abhinav Upadhyay in PR 47385dholland
2011-05-18cleanup saving and restoring errno, and make it similar.christos
2011-05-13don't let readlink trash errno.;christos
2008-02-03fix posix_memalign; we are not going to support alignments > pagesize inchristos
this implementation.
2007-12-12make this compile againmacallan
2007-12-04move decls for _malloc_{pre,post}fork() to extern.hchristos
2007-11-28Sync phk malloc.c with the latest one from FreeBSD. This gives us thechristos
same api as jemalloc by: - adding posix_memalign() - moving calloc in the same file - renaming malloc_options -> _malloc_options
2006-11-24fix spelling of accidentally; from Zapherchristos
2006-10-08PR/34602: sushant: Bug in malloc implementation contains dead code inelad
free_pages() Applied patch from Mindaugas <unex at linija org> (in #NetBSD-code), thanks
2005-12-24__inline__ -> inlineperry
2005-11-29WARNS=4christos
2005-06-12Add missing __RCSID()lukem
2003-10-05Style fixes to reduce diff size against the FreeBSD version, notably:junyoung
- Use NULL where appropriate. - No need to pull in stdint.h. - Get rid of "register" keywords in the hope that the compiler will do a better job for us. :-) - Every message ends with a period. - MMAP() macro is supposed to return MAP_FAILED rather than -1 if it fails. - De-__P.
2003-07-23call malloc_init() on first call to free/realloc, to make malloc.conf toitojun
take effect. in response to PR 22223
2003-01-18Merge the nathanw_sa branch.thorpej
2002-12-09Add a couple of missing THREAD_UNLOCK's, for the error exit path.chris
No functional change on Mainline, however SA branch probably needs this.
2002-11-11Fix signed/unsigned comparison warnings.thorpej
2001-05-06More fixes:christos
1. use uintptr_t instead of u_long 2. check for overflow in map_pages and malloc_pages 3. bring in fixes from FreeBSD [int -> size_t, and a missing THREAD_UNLOCK] 4. rewrite map_pages to use sbrk() only to grow memory (avoids extra syscall and elides bug in brk(2) that ross is fixing) 5. restore the break point to its original value if the mmap(2) for the page directory or the alignment sbrk breaks. reviewed by: chuq and ross tested by: make build and reboot Now memtest nearly works; unfortunately there is no way currently to lower the break point as we free, so memtest keeps trying to reduce memory when mlock() fails and that does not work.
2001-05-03PR/12810: Chris ?: malloc core-dumps when given large number as the argument.christos
This is because integer overflow occurs in the computation of the size of the page directory array. We now detect that, and return ENOMEM.
2001-02-19convert from __progname to getprogname()cgd
2001-01-05we now have utrace, support it herejdolecek
2000-12-20fix sbrk castschristos
2000-07-06avoid losing precision warningschristos
2000-05-20Disable malloc's hints to the kernel - now that the madvise() syscallsimonb
actually does something, this can be expensive. From discussion on current-users. Note that the man page is already correct - we imported malloc.c from FreeBSD before they made the same change but malloc.3 after...
2000-04-07Fix the bug introduced in rev 1.28 and actually caused failure on alpha;enami
In the function malloc_make_chunks, don't define the local variable ``l'', which is used to hold the actual size of pginfo, as size_t. Define it as a signed integer as before. We expect it to become zero or negative value, and we know that it is much smaller than pagesize and it is small enough to fit in signed interger.
2000-04-07Backout the previous backing out.enami
2000-01-31Back out the previous 2 revs. The delint'ing of this file causedthorpej
something to break horribly on the Alpha.
2000-01-23Delint.mycroft
2000-01-23Partially delint, and a few microoptimizations.mycroft
1999-09-10Restore the behaviour of not setting errno to ENOMEM when allocating 0kleink
units of storage and returning a null pointer in System V mode; this was broken by the `fix' in rev. 1.24. Also, as it is stated in ISO C that such operation does not constitute an allocation failure, do not abort() even if the `X' option is set. Amusingly enough the SVID, Fourth Edition, specifies the `unique pointer' return behaviour for this kind of allocation, so this is kind of mis-named.
1999-08-22Need "namespace.h".kleink
1999-07-08Make sure errno is set to ENOMEM if we return NULL.thorpej
1999-07-05index -> ldx (and similar in some related variable names). Avoids a lintthorpej
warning.
1999-07-05Oops, back out 1.21. Christos and I apparently stepped on each other.thorpej
1999-07-05s/index/idx/christos
s/EXTRA_SANITY/MALLOC_EXTRA_SANITY/ const poisoning use sysconf to get the pagesize
1999-07-05Compute page size related parameters at run-time.thorpej
1999-07-05EXTRA_SANITY -> MALLOC_EXTRA_SANITY, consistently.thorpej
1999-07-04Only define MADV_FREE do MADV_DONTNEED if it's not already definedthorpej
by <sys/mman.h>.
1999-06-26The 'new malloc' (phk's malloc, from FreeBSD) is now our only malloc.tls
1999-01-29Protect access of state with a mutex. Miscellaneous notes:kleink
* still needs an implementation-independent ("reentrant.h") method for disabling cancellation, * break a leg to leave realloc() `storage compaction' as was for non-reentrant code, * use of stdio in assertion code is unsafe.
1998-11-15delintchristos
1998-08-26make memcpy into memmove in some casesperry
1998-08-10bzero->memset, bcopy->memcpy, bcmp->memcmpperry
1998-02-03remove obsolete register declarationsperry
1998-01-30update to lite-2perry
1997-07-21If port provides __weak_alias(), provide an Standard C and POSIX purejtc
identifier namespace by renaming non standard functions and variables such that they have a leading underscore. The library will use those names internally. Weak aliases are used to provide the original names to the API. This is only the first part of this change. It is most of the functions which are implemented in C for all NetBSD ports. Subsequent changes are to add the same support to the remaining C files, to assembly files, and to the automagically generated assembly source used for system calls. When all of the above is done, ports with weak alias support should add a definition for __weak_alias to <sys/cdefs.h>.
1997-07-13Add local.h for local prototypes.christos
Fix namespace issues for strtoq and strtouq Fix gcc warnings. Fix RCSID's
1997-04-07PR/3448: Bill Sommerfeld: Change "p" to __STRING(p)christos
1996-12-20don't confuse long and int; pointed out by lintcgd
1996-01-17The C standard says (about realloc) that "If size is zero and ptr isjtc
not a null pointer, the object it points to is freed." Reported by Peter Seebach in PR #1806.