hush: add commented-out debug printouts in "memleak" built-in
Allocation addresses of malloc() are jittery, thought I had a mem leak in hush, but it was malloc variability. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
a769390da6
commit
7f0ebbc69e
@ -942,6 +942,14 @@ int main(int argc UNUSED_PARAM, char **argv)
|
|||||||
*/
|
*/
|
||||||
mallopt(M_MMAP_THRESHOLD, 32 * 1024 - 256);
|
mallopt(M_MMAP_THRESHOLD, 32 * 1024 - 256);
|
||||||
#endif
|
#endif
|
||||||
|
#if 0 /*def M_TOP_PAD*/
|
||||||
|
/* When the program break is increased, then M_TOP_PAD bytes are added
|
||||||
|
* to the sbrk(2) request. When the heap is trimmed because of free(3),
|
||||||
|
* this much free space is preserved at the top of the heap.
|
||||||
|
* glibc default seems to be way too big: 128k, but need to verify.
|
||||||
|
*/
|
||||||
|
mallopt(M_TOP_PAD, 8 * 1024);
|
||||||
|
#endif
|
||||||
|
|
||||||
#if !BB_MMU
|
#if !BB_MMU
|
||||||
/* NOMMU re-exec trick sets high-order bit in first byte of name */
|
/* NOMMU re-exec trick sets high-order bit in first byte of name */
|
||||||
|
@ -9284,6 +9284,15 @@ static int FAST_FUNC builtin_memleak(char **argv UNUSED_PARAM)
|
|||||||
if (l < (unsigned long)p) l = (unsigned long)p;
|
if (l < (unsigned long)p) l = (unsigned long)p;
|
||||||
free(p);
|
free(p);
|
||||||
|
|
||||||
|
|
||||||
|
# if 0 /* debug */
|
||||||
|
{
|
||||||
|
struct mallinfo mi = mallinfo();
|
||||||
|
printf("top alloc:0x%lx malloced:%d+%d=%d\n", l,
|
||||||
|
mi.arena, mi.hblkhd, mi.arena + mi.hblkhd);
|
||||||
|
}
|
||||||
|
# endif
|
||||||
|
|
||||||
if (!G.memleak_value)
|
if (!G.memleak_value)
|
||||||
G.memleak_value = l;
|
G.memleak_value = l;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user