Commit Graph

544 Commits

Author SHA1 Message Date
Pino Toscano 2a26ef3a01 Add HAVE_MREMAP for mremap usage
Introduce (only on Linux) and use a HAVE_MREMAP symbol to advertize mremap
availability.

Move the malloc-sysdep.h include from arena.c to malloc.c, since what is
provided by malloc-sysdep.h is needed earlier in malloc.c, before the inclusion
of arena.c.
2013-01-17 21:08:12 +01:00
H.J. Lu 740b3dbee8 Add --enable-hardcoded-path-in-tests configure option 2013-01-11 07:14:18 -08:00
Joseph Myers 375607b9cc Clean up __MALLOC_* macros. 2013-01-07 15:00:47 +00:00
Andreas Schwab 2f5f40f465 mtrace: properly handle realloc (p, 0) 2013-01-03 11:18:04 +01:00
Joseph Myers 568035b787 Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
Joseph Myers f4cf5f2d8b Add script to update copyright notices and reformat some to facilitate its use. 2013-01-01 16:29:10 +00:00
David S. Miller 0549fbba96 Update copyright years.
* catgets/gencat.c: Update copyright year.
	* csu/version.c: Likewise.
	* debug/catchsegv.sh: Likewise.
	* debug/pcprofiledump.c: Likewise.
	* debug/xtrace.sh: Likewise.
	* elf/ldconfig.c: Likewise.
	* elf/ldd.bash.in: Likewise.
	* elf/pldd.c: Likewise.
	* elf/sotruss.ksh: Likewise.
	* elf/sprof.c: Likewise.
	* iconv/iconv_prog.c: Likewise.
	* iconv/iconvconfig.c: Likewise.
	* locale/programs/locale.c: Likewise.
	* locale/programs/localedef.c: Likewise.
	* login/programs/pt_chown.c: Likewise.
	* malloc/memusage.sh: Likewise.
	* malloc/memusagestat.c: Likewise.
	* malloc/mtrace.pl: Likewise.
	* nscd/nscd.c: Likewise.
	* nss/getent.c: Likewise.
	* nss/makedb.c: Likewise.
	* posix/getconf.c: Likewise.
2013-01-01 00:11:43 -08:00
Pino Toscano e19af3803b muntrace: reset file and hooks before finalizing the stream
fclose will call free, invoking its hook, then fprintf which would indirectly
try to allocate a buffer, and this can cause malloc to be used (thus its hook
to be invoked) if libio uses malloc instead of mmap; given any malloc/free hook
locks the internal lock, this leads to a deadlock.

To prevent this hook roundtrip at muntrace, first unset MALLSTREAM and the
hooks, and only after that close the trace file.
2012-11-19 20:01:00 +01:00
Joseph Myers e3ea54090a Update --version copyright dates for memusagestat and pcprofiledump. 2012-11-15 01:01:33 +00:00
Joseph Myers 8b748aed2a Support --with-pkgversion and --with-bugurl. 2012-11-09 22:13:45 +00:00
Joseph Myers 03ac099f6b Define and use $(run-built-tests). 2012-10-24 00:08:46 +00:00
Joseph Myers e40a0d2113 Use $(run-program-prefix) in more shell script tests. 2012-10-19 23:30:43 +00:00
Roland McGrath 9043e2288e Name space hygeine for madvise. 2012-10-04 16:31:43 -07:00
Dmitry V. Levin bb9510dc34 Clarify memory allocation error diagnostics to avoid confusion 2012-10-02 16:09:30 +00:00
Siddhesh Poyarekar 9fab36eb58 Shrink heap on linux when overcommit_memory == 2
Using madvise with MADV_DONTNEED to release memory back to the kernel
is not sufficient to change the commit charge accounted against the
process on Linux.  It is OK however, when overcommit is enabled or is
heuristic.  However, when overcommit is restricted to a percentage of
memory setting the contents of /proc/sys/vm/overcommit_memory as 2, it
makes a difference since memory requests will fail.  Hence, we do what
we do with secure exec binaries, which is to call mmap on the region
to be dropped with MAP_FIXED. This internally unmaps the pages in
question and reduces the amount of memory accounted against the
process.
2012-09-25 14:30:52 +05:30
Dmitry V. Levin 57c69bef13 Set "fail on error" mode directly in testsuite shell scripts 2012-09-25 02:48:31 +00:00
H.J. Lu ced6f16ee9 Properly handle fencepost with MALLOC_ALIGN_MASK 2012-09-24 08:58:04 -07:00
Siddhesh Poyarekar c78ab09473 Cleanup code duplication in malloc on fallback to use another arena
Break the fallback code to try another arena into a separate function
for readability.
2012-09-07 14:40:58 +05:30
Alexandre Oliva 24d4e01b22 * malloc/arena.c: Fold copyright years.
* malloc/mcheck.c, malloc/memusage.c: Likewise.
2012-09-05 20:47:16 -03:00
Alexandre Oliva 61d5817416 * malloc/malloc.c (__libc_mallopt) <M_MMAP_MAX>: Fix indentation. 2012-09-05 20:37:37 -03:00
Alexandre Oliva 5c44738353 Don't change no_dyn_threshold on mallopt failure
* malloc/malloc.c (__libc_mallopt) <M_MMAP_THRESHOLD>: Do not
	change internal state upon failure.
2012-09-05 15:43:04 -03:00
Alexandre Oliva fad64255f4 Fix typos in malloc/.
* malloc/mcheck.c (mcheck_check_all): Fix typo.
	* malloc/memusage.c (mmap): Likewise.
	(mmap64, mremap): Likewise.  Adjust name in comment.
2012-09-05 15:19:44 -03:00
Siddhesh Poyarekar 6ef9cc37f0 Return requested size for malloc_usable_size when MALLOC_CHECK_ > 0
[BZ #1349]

malloc_usable_size returns the usable size in an allocated chunk,
which may be >= the requested size. In the case of MALLOC_CHECK_ being
exported to > 0 however, only the requested size is usable, since a
magic value is written at the end of the request size to trap writes
beyond request bounds. Hence, when MALLOC_CHECK_ is exported to > 0,
malloc_usable_size() should return the request size.
2012-09-05 21:49:30 +05:30
Roland McGrath 750c1f2a9a Make malloc build for no-threads configurations. 2012-08-17 11:29:45 -07:00
Jeff Law 77480c6ba5 Fix whitespace problems detected by commit hooks. 2012-08-10 09:39:58 -06:00
Jeff Law bf51f568f1 [BZ #13939]
* malloc.c/arena.c (reused_arena): New parameter, avoid_arena.
        When avoid_arena is set, don't retry in the that arena.  Pick the
        next one, whatever it might be.
        (arena_get2): New parameter avoid_arena, pass through to reused_arena.
        (arena_lock): Pass in new parameter to arena_get2.
        * malloc/malloc.c (__libc_memalign): Pass in new parameter to
        arena_get2.
        (__libc_malloc): Unify retrying after main arena failure with
        __libc_memalign version.
        (__libc_valloc, __libc_pvalloc, __libc_calloc): Likewise.
2012-08-10 09:37:52 -06:00
Florian Weimer 84b3fd8407 Rename __secure_getenv to secure_getenv 2012-07-25 19:46:22 +02:00
H.J. Lu 347c92e9e7 Make free chunk size a multiple of MALLOC_ALIGNMENT 2012-05-24 17:50:28 -07:00
Andreas Schwab d18ea0c5e6 Remove use of INTDEF/INTUSE in libio 2012-05-24 23:06:20 +02:00
H.J. Lu b5a2bbe6cc Properly handle MALLOC_ALIGNMENT > 2 * SIZE_SZ 2012-05-24 11:57:23 -07:00
Andreas Jaeger 662742187c Fix last change
Include shlib-compat.h for SHLIB_COMPAT.
2012-05-21 21:02:33 +02:00
Roland McGrath cbc00a0398 Set MALLOC_ALIGNMENT to at least __alignof__ (long double) for new ABIs. 2012-05-21 11:13:10 -07:00
Paul Pluzhnikov bedee953d8 For [BZ #208], accumulate malloc stats over all arenas. 2012-05-16 16:46:10 -07:00
Andreas Jaeger f0c1dedf0d Fix tst-obprintf - and mcheck in general
tst-obprintf failed with GCC 4.7.

It turned out that this is the fault of GCC optimizing away the
following from malloc/mcheck.c:
      /* We call malloc() once here to ensure it is initialized.  */
      void *p = malloc (0);
      free (p);

gcc sees the malloc(0);free pair and removes it completely.

And now malloc is not properly initialized and we screw up if both
mcheck is used (via tst-obprintf) and MALLOC_CHECK_ is set (as it is in my
environment).
2012-05-03 22:12:59 +02:00
Ulrich Drepper 05f3d1f6c6 Avoid warnings in test malloc program 2012-03-28 13:05:11 -04:00
H.J. Lu eb96ffb07d Move stdio-common/_itoa.h to sysdeps/generic 2012-03-20 16:00:23 -07:00
Ulrich Drepper a4300c7a4d Remove distribute variable from Makefiles 2012-03-07 05:17:13 -05:00
Paul Eggert 59ba27a63a Replace FSF snail mail address with URLs. 2012-02-09 23:18:22 +00:00
Ulrich Drepper 3b49edc04b Cleanups of malloc
Remove ugly names and unnecessary wrappers.
2012-01-31 18:49:22 -05:00
Ulrich Drepper 41b81892f1 Handle ARENA_TEST correctly 2012-01-31 14:42:34 -05:00
Joseph Myers 7071ad79db Remove __STDC__ conditionals from installed headers. 2012-01-26 20:49:22 +00:00
Ulrich Drepper 6e4b210745 More minor malloc cleanups 2012-01-17 19:21:09 -05:00
Ulrich Drepper d77e786926 Minor cleanups of malloc code 2012-01-16 12:07:56 -05:00
Ulrich Drepper a784e50247 Remove pre-ISO C support
No more __const.
2012-01-07 23:57:22 -05:00
Ulrich Drepper 380d7e87dc Implement aligned_alloc 2012-01-01 07:17:21 -05:00
Ulrich Drepper 81fb02b046 Update copyright year 2012-01-01 05:50:05 -05:00
Ulrich Drepper 4104316861 Optimize tr_freehook 2011-12-22 11:38:32 -05:00
Ulrich Drepper 8a426e1289 Fix comment in mcheck.h 2011-12-03 07:14:40 -05:00
Andreas Schwab a5fb313cb7 Don't call reused_arena when _int_new_arena failed 2011-11-14 11:53:46 +01:00
Andreas Schwab 77cdc054e0 Check malloc arana limit atomically 2011-11-10 11:00:59 +01:00