diff options
author | Alexandre Oliva <aoliva@redhat.com> | 2013-09-20 11:10:56 -0300 |
---|---|---|
committer | Alexandre Oliva <aoliva@redhat.com> | 2013-09-20 11:54:58 -0300 |
commit | 322dea08387167e3c3a9c9b60325ebafa264bd77 (patch) | |
tree | 7239f9202a5035c424b38196868cec5cb28b45a4 /malloc/malloc.c | |
parent | 655673f312318a9d95b71ef9f95a59ff36b0a487 (diff) | |
download | glibc-322dea08387167e3c3a9c9b60325ebafa264bd77.tar.gz glibc-322dea08387167e3c3a9c9b60325ebafa264bd77.tar.xz glibc-322dea08387167e3c3a9c9b60325ebafa264bd77.zip |
Add malloc probes for sbrk and heap resizing.
for ChangeLog * malloc/arena.c (new_heap): New memory_heap_new probe. (grow_heap): New memory_heap_more probe. (shrink_heap): New memory_heap_less probe. (heap_trim): New memory_heap_free probe. * malloc/malloc.c (sysmalloc): New memory_sbrk_more probe. (systrim): New memory_sbrk_less probe. * manual/probes.texi: Document them.
Diffstat (limited to 'malloc/malloc.c')
-rw-r--r-- | malloc/malloc.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/malloc/malloc.c b/malloc/malloc.c index 5b4fcff70e..29382340cf 100644 --- a/malloc/malloc.c +++ b/malloc/malloc.c @@ -2448,8 +2448,10 @@ static void* sysmalloc(INTERNAL_SIZE_T nb, mstate av) below even if we cannot call MORECORE. */ - if (size > 0) + if (size > 0) { brk = (char*)(MORECORE(size)); + LIBC_PROBE (memory_sbrk_more, 2, brk, size); + } if (brk != (char*)(MORECORE_FAILURE)) { /* Call the `morecore' hook if necessary. */ @@ -2747,6 +2749,8 @@ static int systrim(size_t pad, mstate av) (*hook) (); new_brk = (char*)(MORECORE(0)); + LIBC_PROBE (memory_sbrk_less, 2, new_brk, extra); + if (new_brk != (char*)MORECORE_FAILURE) { released = (long)(current_brk - new_brk); |