[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
memory leak in bash
From: |
wuzongyong (A) |
Subject: |
memory leak in bash |
Date: |
Thu, 11 May 2017 08:47:01 +0000 |
Hi,
I met a memory leak to use valgrind run shell code below:
#! /bin/bash
rc_exit ()
{
exit 0
}
rc_exit
And the valgrind log just like that:
HEAP SUMMARY:
==27459== in use at exit: 21,968 bytes in 464 blocks
==27459== total heap usage: 568 allocs, 104 frees, 29,714 bytes allocated
==27459==
==27459== 72 (32 direct, 40 indirect) bytes in 1 blocks are definitely lost in
loss record 267 of 288
==27459== at 0x4C29BE3: malloc (vg_replace_malloc.c:299)
==27459== by 0x46A1AA: xmalloc (in /usr/bin/bash)
==27459== by 0x42B44A: make_bare_simple_command (in /usr/bin/bash)
==27459== by 0x42B525: make_simple_command (in /usr/bin/bash)
==27459== by 0x42839D: yyparse (in /usr/bin/bash)
==27459== by 0x41DEF9: parse_command (in /usr/bin/bash)
==27459== by 0x41DFBB: read_command (in /usr/bin/bash)
==27459== by 0x41E1BB: reader_loop (in /usr/bin/bash)
==27459== by 0x41C8BD: main (in /usr/bin/bash)
==27459==
==27459== LEAK SUMMARY:
==27459== definitely lost: 32 bytes in 1 blocks
==27459== indirectly lost: 40 bytes in 2 blocks
==27459== possibly lost: 0 bytes in 0 blocks
==27459== still reachable: 21,896 bytes in 461 blocks
==27459== suppressed: 0 bytes in 0 blocks
==27459== Reachable blocks (those to which a pointer was found) are not shown.
==27459== To see them, rerun with: --leak-check=full --show-leak-kinds=all
==27459==
==27459== For counts of detected and suppressed errors, rerun with: -v
==27459== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
My bash version is version 4.2.46(1)-release, valgrind version is 3.11.0 ,
could someone help to tell me if it is a bug please? And I wanna to know the
deeply level reason.
Thanks,
Zongyong Wu
- memory leak in bash,
wuzongyong (A) <=