bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Maybe a potential memory leak


From: jr89197
Subject: Maybe a potential memory leak
Date: Sat, 5 Jan 2019 14:32:32 +0800 (CST)

Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64' 
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-redhat-linux-gnu' 
-DCONF_VENDOR='redhat' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL 
-DHAVE_CONFIG_H   -I.  -I. -I./include -I./lib  -D_GNU_SOURCE -DRECYCLES_PIDS 
-DDEFAULT_PATH_VALUE='/usr/local/bin:/usr/bin'  -O2 -g -pipe -Wall 
-Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong 
--param=ssp-buffer-size=4 -grecord-gcc-switches   -m64 -mtune=generic
uname output: Linux enlighten.packetx 3.10.0-327.el7.x86_64 #1 SMP Thu Nov 19 
22:10:57 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
Machine Type: x86_64-redhat-linux-gnu

Bash Version: 4.2
Patch Level: 46
Release Status: release

Description:
    Some library built as shared library and the unit test programs will be 
compiled into a script instead of binary file.
    Then run command `valgrind --leak-check=full ./tests/xxxx' shows:

==122011== HEAP SUMMARY:
==122011==     in use at exit: 25,097 bytes in 548 blocks
==122011==   total heap usage: 798 allocs, 250 frees, 48,294 bytes allocated
==122011== 
==122011== 24 bytes in 1 blocks are definitely lost in loss record 138 of 304
==122011==    at 0x4C29BC3: malloc (vg_replace_malloc.c:299)
==122011==    by 0x46A22A: xmalloc (in /usr/bin/bash)
==122011==    by 0x4318E3: execute_command_internal (in /usr/bin/bash)
==122011==    by 0x46F403: parse_and_execute (in /usr/bin/bash)
==122011==    by 0x44A054: command_substitute (in /usr/bin/bash)
==122011==    by 0x44FEEB: ??? (in /usr/bin/bash)
==122011==    by 0x450F7B: ??? (in /usr/bin/bash)
==122011==    by 0x45137B: expand_word_unsplit (in /usr/bin/bash)
==122011==    by 0x4320A5: execute_command_internal (in /usr/bin/bash)
==122011==    by 0x433B5D: execute_command (in /usr/bin/bash)
==122011==    by 0x431FC0: execute_command_internal (in /usr/bin/bash)
==122011==    by 0x433B5D: execute_command (in /usr/bin/bash)
==122011== 
==122011== LEAK SUMMARY:
==122011==    definitely lost: 24 bytes in 1 blocks
==122011==    indirectly lost: 0 bytes in 0 blocks
==122011==      possibly lost: 0 bytes in 0 blocks
==122011==    still reachable: 25,073 bytes in 547 blocks
==122011==         suppressed: 0 bytes in 0 blocks
==122011== Reachable blocks (those to which a pointer was found) are not shown.
==122011== To see them, rerun with: --leak-check=full --show-leak-kinds=all
==122011== 
==122011== For counts of detected and suppressed errors, rerun with: -v
==122011== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)

and

==122012== HEAP SUMMARY:
==122012==     in use at exit: 23,591 bytes in 502 blocks
==122012==   total heap usage: 991 allocs, 489 frees, 55,813 bytes allocated
==122012== 
==122012== 34 bytes in 1 blocks are definitely lost in loss record 208 of 274
==122012==    at 0x4C29BC3: malloc (vg_replace_malloc.c:299)
==122012==    by 0x46A22A: xmalloc (in /usr/bin/bash)
==122012==    by 0x4318E3: execute_command_internal (in /usr/bin/bash)
==122012==    by 0x433B5D: execute_command (in /usr/bin/bash)
==122012==    by 0x432FC5: execute_command_internal (in /usr/bin/bash)
==122012==    by 0x433B5D: execute_command (in /usr/bin/bash)
==122012==    by 0x41E284: reader_loop (in /usr/bin/bash)
==122012==    by 0x41C8ED: main (in /usr/bin/bash)
==122012== 
==122012== LEAK SUMMARY:
==122012==    definitely lost: 34 bytes in 1 blocks
==122012==    indirectly lost: 0 bytes in 0 blocks
==122012==      possibly lost: 0 bytes in 0 blocks
==122012==    still reachable: 23,557 bytes in 501 blocks
==122012==         suppressed: 0 bytes in 0 blocks
==122012== Reachable blocks (those to which a pointer was found) are not shown.
==122012== To see them, rerun with: --leak-check=full --show-leak-kinds=all
==122012== 
==122012== For counts of detected and suppressed errors, rerun with: -v
==122012== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
==122014==
==122014== HEAP SUMMARY:
==122014==     in use at exit: 59,725 bytes in 1,937 blocks
==122014==   total heap usage: 4,602 allocs, 2,665 frees, 191,507 bytes 
allocated
==122014== 
==122014== 14 bytes in 1 blocks are definitely lost in loss record 117 of 595
==122014==    at 0x4C29BC3: malloc (vg_replace_malloc.c:299)
==122014==    by 0x46A22A: xmalloc (in /usr/bin/bash)
==122014==    by 0x4306D8: ??? (in /usr/bin/bash)
==122014==    by 0x4326AA: execute_command_internal (in /usr/bin/bash)
==122014==    by 0x4352D0: ??? (in /usr/bin/bash)
==122014==    by 0x43318D: execute_command_internal (in /usr/bin/bash)
==122014==    by 0x46F403: parse_and_execute (in /usr/bin/bash)
==122014==    by 0x44A054: command_substitute (in /usr/bin/bash)
==122014==    by 0x44FEEB: ??? (in /usr/bin/bash)
==122014==    by 0x450F7B: ??? (in /usr/bin/bash)
==122014==    by 0x451419: expand_string_assignment (in /usr/bin/bash)
==122014==    by 0x44B1CD: ??? (in /usr/bin/bash)
==122014== 
==122014== LEAK SUMMARY:
==122014==    definitely lost: 14 bytes in 1 blocks
==122014==    indirectly lost: 0 bytes in 0 blocks
==122014==      possibly lost: 0 bytes in 0 blocks
==122014==    still reachable: 59,711 bytes in 1,936 blocks
==122014==         suppressed: 0 bytes in 0 blocks
==122014== Reachable blocks (those to which a pointer was found) are not shown.
==122014== To see them, rerun with: --leak-check=full --show-leak-kinds=all
==122014== 
==122014== For counts of detected and suppressed errors, rerun with: -v
==122014== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
==122013==

Repeat-By:
    Tested two library are happened the same problem, `json-c-0.13.1-20180305' 
and `libevent-2.1.8-stable'.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]