summaryrefslogtreecommitdiffstats
path: root/lib/libc/stdlib
Commit message (Collapse)AuthorAgeFilesLines
* Allow the 'n' option to decrease the number of arenas below the default,jasone2006-03-261-2/+16
| | | | | to as little as one arena. Also, limit the number of arenas to avoid a potential invariant violation in base_alloc().
* Add comments and reformat/rearrange code. There are no significantjasone2006-03-261-208/+224
| | | | functional changes in this commit.
* Convert TINY_MIN_2POW from a cpp macro to tiny_min_2pow (a variable), andjasone2006-03-241-21/+37
| | | | | | | | | | | | | | | determine its value at run time according to other relevant values. This avoids the creation of runs that are incompletely utilized, as long as pagesize isn't too large (>32kB, given the current RUN_MIN_REGS_2POW setting). Increase the size of several structure bitfields in arena_run_t in order to avoid integer overflow in the case that a run's header does not overlap with the space that is usable as application allocation regions. Given the tiny_min_2pow change, this fix has no additional impact unless pagesize is >32kB. Reported by: kris
* Add USE_BRK-specific code in malloc_init_hard() to allow the firstjasone2006-03-241-65/+110
| | | | | | | | | | | | | | | | | | | internally used chunk to start at the beginning of the heap, rather than at a chunk-aligned address. This reduces mapped memory somewhat for 32-bit architectures. Add the arena_run_link_t type and use it wherever a run object is only used as a ring 'header'. This saves approximately 40 kB of memory per arena. Remove an obsolete (no longer used) code path from base_alloc(), which supported the internal allocation of objects larger than the chunk size. Enhance chunk_dealloc() to cache chunk addresses for all deallocated chunks. This has no impact for most programs, but has the potential to reduce VM map fragmentation for programs that use huge allocations.
* Separate completely full runs from runs that are merely almost full, sojasone2006-03-201-61/+71
| | | | | | | that no linear searching is necessary if we resort to allocating from a run that is known to be mostly full. There are pathological edge cases that could have caused severely degraded performance, and this change fixes that.
* Optimize realloc() to reallocate in place if the old and new sizes arejasone2006-03-191-105/+167
| | | | | | | | | | | close enough to each other that reallocation would allocate a new region of the same size. This improves the performance of repeated incremental reallocations by up to three orders of magnitude. [1] Fix arena_new() to properly constrain run size if a small chunk size was specified during runtime configuration. Suggested by: se [1]
* Modify allocation policy, in order to avoid excessive fragmentation forjasone2006-03-172-2503/+1070
| | | | | | | | | | | | | | | allocation patterns that involve a relatively even mixture of many different size classes. Reduce the chunk size from 16 MB to 2 MB. Since chunks are now carved up using an address-ordered first best fit policy, VM map fragmentation is much less likely, which makes smaller chunks not as much of a risk. This reduces the virtual memory size of most applications. Remove redzones, since program buffer overruns are no longer as likely to corrupt malloc data structures. Remove the C MALLOC_OPTIONS flag, and add H and S.
* Add a non-optional newline after ".Bx".ru2006-03-151-1/+2
|
* Revert previous changes as we do support the .Ox macro for OpenBSD.andre2006-03-151-2/+4
| | | | Pointed out by: ceri, ru, delphij
* POSIXed strtoll() (and ours one too) can set errno to EINVAL, so checkache2006-03-141-1/+1
| | | | | | it first. Approved by: andre
* Fix HISTORY and point to OpenBSD.andre2006-03-141-5/+2
|
* Import of OpenBSD's strtonum(3) which is a nicer version of strtoll(3)andre2006-03-144-3/+227
| | | | | | | | providing proper error checking and other improvements. Obtained from: OpenBSD Requested by: flz (to port Open[BGP|OSPF]D) MFC after: 3 days
* Add each directory's symbol map file to SYM_MAPS.deischen2006-03-131-0/+2
|
* Add symbol maps and initial symbol version definitions to libc.deischen2006-03-131-0/+98
| | | | Reviewed by: davidxu
* Fix typo in manual page reference.wkoszek2006-02-261-1/+1
| | | | | Approved by: cognet (mentor) MFC after: 3 days
* Remove extra slash from pty slave device name returned by ptsname.kan2006-02-131-1/+1
|
* Fix calculation of the number of arenas to use on multi-processor systems.jasone2006-02-041-1/+1
|
* Expand contractions.joel2006-02-011-1/+1
|
* If the sysctl kern.pts.enable doesn't exist, check that /dev/ptmx is there,cognet2006-01-291-2/+7
| | | | | | and if so, use the pts system. Suggested by: rwatson
* Remove unwarranted uses of 'goto'.jasone2006-01-271-203/+153
|
* Add NO_MALLOC_EXTRAS, so that various extra features that can causejasone2006-01-271-3/+16
| | | | | | | | | performance degradation can be disabled via something like the following in /etc/malloc.conf: CFLAGS+=-DNO_MALLOC_EXTRAS Suggested by: deischen
* Fix the type of a statistics counter (unsigned --> unsigned long).jasone2006-01-271-1/+1
|
* Clean up statistics gathering and printing.jasone2006-01-271-71/+64
|
* Optimize arena_bin_pop() to reduce the number of separator operations.jasone2006-01-261-13/+10
| | | | | | | | Remove the block of code that tries to use delayed regions in LIFO order, since from a policy perspective, it conflicts with LRU caching of newly coalesced regions in arena_undelay(). There are numerous policy alternatives, and it isn't readily obvious which (if any) is superior; this change at least has the virtue of being consistent with policy.
* ptsname() bits for pts.cognet2006-01-261-5/+45
|
* Remove a redundant variable assignment in arena_reg_frag_alloc().jasone2006-01-251-1/+0
|
* If no coalesced exact-fit small regions are available, but delayed exact-jasone2006-01-251-173/+186
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | fit regions are available, use the delayed regions in LIFO order, in order to increase locality of reference. We might expect this to cause delayed regions to be removed from the delay ring buffer more often (since we're now re-using more recently buffered regions), but numerous tests indicate that the overall impact on memory usage tends to be good (reduced fragmentation). Re-work arena_frag_reg_alloc() so that when large free regions are exhausted, it uses small regions in a way that favors contiguous allocation of sequentially allocated small regions. Use arena_frag_reg_alloc() in this capacity, rather than directly attempting over-fitting of small requests when no large regions are available. Remove the bin overfit statistic, since it is no longer relevant due to the arena_frag_reg_alloc() changes. Do not specify arena_frag_reg_alloc() as an inline function. It is too large to benefit much from being inlined, and it is also called in two places, only one of which is in the critical path (the other call bloated arena_reg_alloc()). Call arena_coalesce() for a region before caching it with arena_mru_cache(). Add assertions that detect the attempted caching of adjacent free regions, so that we notice this problem when it is first created, rather than in arena_coalesce(), when it's too late to know how the problem arose. Reported by: Hans Blancke
* Make the 'C' and 'c' malloc options consistent with other options; 'C'jasone2006-01-231-2/+2
| | | | doubles the cache size, and 'c' halves the cache size.
* In arena_chunk_reg_alloc(), try to avoid touching the last page in thejasone2006-01-231-7/+24
| | | | | chunk during initialization, in order to avoid physically backing the page unless data are allocated there.
* Use uintptr_t rather than size_t when casting pointers to integers. Also,jasone2006-01-201-44/+45
| | | | | | | fix the few remaining casting style(9) errors that remained after the functional change. Reported by: jmallett
* Revert addtion of assertions in revision 1.99. These assertions causejasone2006-01-191-7/+0
| | | | | | problems in cases where regions are faked up for the purposes of red-black tree searches, since those faked region headers reside on the stack, rather than in a malloc chunk.
* Add assertions that detect some forms of region separator corruption.jasone2006-01-191-0/+7
|
* Remove loops in arena_coalesce(). They are no longer necessary, now thatjasone2006-01-191-4/+5
| | | | | internal allocation does not rely on recursive arena use (base_arena was removed in revision 1.95).
* Make all internal variables and functions static.jasone2006-01-191-12/+15
| | | | Reported by: ache
* Return NULL if there is an OOM error during initialization, rather thanjasone2006-01-191-35/+50
| | | | | | | | allowing the error to be fatal. Move a label in order to make sure to properly handle errors in malloc(0). Reported by: Alastair D'Silva, Saneto Takanori
* Add a separate simple internal base allocator and remove base_arena, so thatjasone2006-01-161-151/+175
| | | | | | | | | | there is never any need to recursively call the main allocation functions. Remove recursive spinlock support, since it is no longer needed. Allow chunks to be as small as the page size. Correctly propagate OOM errors from arena_new().
* Define NO_TLS on ia64. The dynamic TLS implementation on ia64 ismarcel2006-01-161-0/+1
| | | | | | | | | broken for non-threaded shared processes in that __tls_get_addr() assumes the thread pointer is always initialized. This is not the case. When arenas_map is referenced in choose_arena() and it is defined as a thread-local variable, it will result in a SIGSEGV. PR: ia64/91846 (describes the TLS/ia64 bug).
* Replace malloc(), calloc(), posix_memalign(), realloc(), and free() withjasone2006-01-132-1107/+4597
| | | | | | | a scalable concurrent allocator implementation. Reviewed by: current@ Approved by: phk, markm (mentor)
* Fix a bitwise logic error in posix_memalign().jasone2006-01-121-2/+2
| | | | Reported by: glebius
* In preparation for a new malloc implementation:jasone2006-01-124-63/+156
| | | | | | | | | | | | | * Add posix_memalign(). * Move calloc() from calloc.c to malloc.c. Add a calloc() implementation in rtld-elf in order to make the loader happy (even though calloc() isn't used in rtld-elf). * Add _malloc_prefork() and _malloc_postfork(), and use them instead of directly manipulating __malloc_lock. Approved by: phk, markm (mentor)
* Add a64l(), l64a(), and l64a_r() XSI extentions. These functions converttrhodes2005-12-244-5/+290
| | | | | | | | between a 32-bit integer and a radix-64 ASCII string. The l64a_r() function is a NetBSD addition. PR: 51209 (based on submission, but very different) Reviewed by: bde, ru
* Fix prototype.ru2005-11-231-1/+3
|
* Include a couple of headers to ensure consistency between the prototype andstefanf2005-09-121-0/+1
| | | | the function definition.
* Move the declaration of __cleanup to libc_private.h as it is used in bothstefanf2005-09-122-2/+4
| | | | stdio/ and stdlib/. Don't define __cleanup twice.
* Fix ptsname(3) by converting it to use devname(3) to obtain the name ofmarcus2005-07-071-3/+4
| | | | | | | | | | | | a tty device instead of the legacy minor number approach. This is known to fix gnome-vfs' sftp module as well as kio_sftp and kdesu on -CURRENT. Thanks to scottl for the snprintf() approach idea. Reviewed by: phk Tested by: pav mich Approved by: re (scottl)
* Do not require the pty(4) majors to be anything in particular.green2005-03-041-3/+0
|
* Remove the check about whether MALLOC_EXTRA_SANITY is defined,delphij2005-02-271-2/+0
| | | | | | | | | surrounding the undef'ing it. It does not seem necessary to undef some symbol that is not exist, and gcc does not complain about whether a symbol is exist before #undef'ing it out. Spotted by: mingyanguo via ChinaUnix.net forum Reviewed by: phk
* Especially mention that setting errno to EINVAL in "no conversion" caseache2005-01-222-4/+8
| | | | | | is not portable. Asked by: joerg
* Whitespace/style tweaking of prev. commit.ache2005-01-216-24/+18
| | | | Noted by: bde
* POSIX says that 0[xX] prefix is _optional_ even in base 16 case, make itache2005-01-216-6/+30
| | | | | | | | | | really so. "If the value of base is 16, the characters 0x or 0X may optionally precede the sequence of letters and digits, following the sign if present." Found by: joerg
OpenPOWER on IntegriCloud