➜ 42sh git:(master) ✗ echo AAA \
> | (echo bbb 1; cat -e; echo cccc 1) \
> | (echo bbb 2; cat -e; echo cccc 2) \
> | (echo bbb 3; cat -e; echo cccc 3) \
> | (echo bbb 4; cat -e; echo cccc 4) \
> | (echo bbb 5; cat -e; echo cccc 5)
==2541==
==2541== HEAP SUMMARY:
==2541== in use at exit: 82,332 bytes in 899 blocks
==2541== total heap usage: 4,163 allocs, 3,264 frees, 25,610,274 bytes allocated
==2541==
==2541== 290 (240 direct, 50 indirect) bytes in 10 blocks are definitely lost in loss record 60 of 77
==2541== at 0x4C2DB9D: malloc (vg_replace_malloc.c:299)
==2541== by 0x41C2B0: ft_malloc (in /home/gwojda/42sh/42sh)
==2541== by 0x41BED3: ft_lstnew (in /home/gwojda/42sh/42sh)
==2541== by 0x41C0B9: push (in /home/gwojda/42sh/42sh)
==2541== by 0x40737F: exec_pushfds (in /home/gwojda/42sh/42sh)
==2541== by 0x407078: exec_init (in /home/gwojda/42sh/42sh)
==2541== by 0x4169BF: data_init (in /home/gwojda/42sh/42sh)
==2541== by 0x417450: shell_init (in /home/gwojda/42sh/42sh)
==2541== by 0x417051: main (in /home/gwojda/42sh/42sh)
==2541==
==2541== LEAK SUMMARY:
==2541== definitely lost: 240 bytes in 10 blocks
==2541== indirectly lost: 50 bytes in 10 blocks
==2541== possibly lost: 0 bytes in 0 blocks
==2541== still reachable: 82,042 bytes in 879 blocks
==2541== suppressed: 0 bytes in 0 blocks
==2541== Reachable blocks (those to which a pointer was found) are not shown.
==2541== To see them, rerun with: --leak-check=full --show-leak-kinds=all
==2541==
==2541== For counts of detected and suppressed errors, rerun with: -v
==2541== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
bbb 5
bbb 4$
==2542==
==2542== HEAP SUMMARY:
==2542== in use at exit: 83,511 bytes in 957 blocks
==2542== total heap usage: 4,752 allocs, 3,795 frees, 26,010,607 bytes allocated
==2542==
==2542== 283 (24 direct, 259 indirect) bytes in 1 blocks are definitely lost in loss record 95 of 113
==2542== at 0x4C2DB9D: malloc (vg_replace_malloc.c:299)
==2542== by 0x41C2B0: ft_malloc (in /home/gwojda/42sh/42sh)
==2542== by 0x41BED3: ft_lstnew (in /home/gwojda/42sh/42sh)
==2542== by 0x40F13C: job_addprocess (in /home/gwojda/42sh/42sh)
==2542== by 0x40716A: exec_leaf (in /home/gwojda/42sh/42sh)
==2542== by 0x4075F6: ft_exec (in /home/gwojda/42sh/42sh)
==2542== by 0x40728E: exec_pipe (in /home/gwojda/42sh/42sh)
==2542== by 0x4075F6: ft_exec (in /home/gwojda/42sh/42sh)
==2542== by 0x40728E: exec_pipe (in /home/gwojda/42sh/42sh)
==2542== by 0x4075F6: ft_exec (in /home/gwojda/42sh/42sh)
==2542== by 0x40728E: exec_pipe (in /home/gwojda/42sh/42sh)
==2542== by 0x4075F6: ft_exec (in /home/gwojda/42sh/42sh)
==2542==
==2542== 290 (240 direct, 50 indirect) bytes in 10 blocks are definitely lost in loss record 96 of 113
==2542== at 0x4C2DB9D: malloc (vg_replace_malloc.c:299)
==2542== by 0x41C2B0: ft_malloc (in /home/gwojda/42sh/42sh)
==2542== by 0x41BED3: ft_lstnew (in /home/gwojda/42sh/42sh)
==2542== by 0x41C0B9: push (in /home/gwojda/42sh/42sh)
==2542== by 0x40737F: exec_pushfds (in /home/gwojda/42sh/42sh)
==2542== by 0x407078: exec_init (in /home/gwojda/42sh/42sh)
==2542== by 0x4169BF: data_init (in /home/gwojda/42sh/42sh)
==2542== by 0x417450: shell_init (in /home/gwojda/42sh/42sh)
==2542== by 0x417051: main (in /home/gwojda/42sh/42sh)
==2542==
==2542== LEAK SUMMARY:
==2542== definitely lost: 264 bytes in 11 blocks
==2542== indirectly lost: 309 bytes in 16 blocks
==2542== possibly lost: 0 bytes in 0 blocks
==2542== still reachable: 82,938 bytes in 930 blocks
==2542== suppressed: 0 bytes in 0 blocks
==2542== Reachable blocks (those to which a pointer was found) are not shown.
==2542== To see them, rerun with: --leak-check=full --show-leak-kinds=all
==2542==
==2542== For counts of detected and suppressed errors, rerun with: -v
==2542== ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 0 from 0)
bbb 3$$
bbb 2$$$
bbb 1$$$$
AAA$$$$$
cccc 1$$$$
cccc 2$$$
==2543==
==2543== HEAP SUMMARY:
==2543== in use at exit: 84,518 bytes in 1,009 blocks
==2543== total heap usage: 4,804 allocs, 3,795 frees, 26,011,614 bytes allocated
==2543==
==2543== 290 (240 direct, 50 indirect) bytes in 10 blocks are definitely lost in loss record 125 of 143
==2543== at 0x4C2DB9D: malloc (vg_replace_malloc.c:299)
==2543== by 0x41C2B0: ft_malloc (in /home/gwojda/42sh/42sh)
==2543== by 0x41BED3: ft_lstnew (in /home/gwojda/42sh/42sh)
==2543== by 0x41C0B9: push (in /home/gwojda/42sh/42sh)
==2543== by 0x40737F: exec_pushfds (in /home/gwojda/42sh/42sh)
==2543== by 0x407078: exec_init (in /home/gwojda/42sh/42sh)
==2543== by 0x4169BF: data_init (in /home/gwojda/42sh/42sh)
==2543== by 0x417450: shell_init (in /home/gwojda/42sh/42sh)
==2543== by 0x417051: main (in /home/gwojda/42sh/42sh)
==2543==
==2543== 1,290 (24 direct, 1,266 indirect) bytes in 1 blocks are definitely lost in loss record 137 of 143
==2543== at 0x4C2DB9D: malloc (vg_replace_malloc.c:299)
==2543== by 0x41C2B0: ft_malloc (in /home/gwojda/42sh/42sh)
==2543== by 0x41BED3: ft_lstnew (in /home/gwojda/42sh/42sh)
==2543== by 0x40F13C: job_addprocess (in /home/gwojda/42sh/42sh)
==2543== by 0x40716A: exec_leaf (in /home/gwojda/42sh/42sh)
==2543== by 0x4075F6: ft_exec (in /home/gwojda/42sh/42sh)
==2543== by 0x40728E: exec_pipe (in /home/gwojda/42sh/42sh)
==2543== by 0x4075F6: ft_exec (in /home/gwojda/42sh/42sh)
==2543== by 0x40728E: exec_pipe (in /home/gwojda/42sh/42sh)
==2543== by 0x4075F6: ft_exec (in /home/gwojda/42sh/42sh)
==2543== by 0x40728E: exec_pipe (in /home/gwojda/42sh/42sh)
==2543== by 0x4075F6: ft_exec (in /home/gwojda/42sh/42sh)
==2543==
==2543== LEAK SUMMARY:
==2543== definitely lost: 264 bytes in 11 blocks
==2543== indirectly lost: 1,316 bytes in 68 blocks
==2543== possibly lost: 0 bytes in 0 blocks
==2543== still reachable: 82,938 bytes in 930 blocks
==2543== suppressed: 0 bytes in 0 blocks
==2543== Reachable blocks (those to which a pointer was found) are not shown.
==2543== To see them, rerun with: --leak-check=full --show-leak-kinds=all
==2543==
==2543== For counts of detected and suppressed errors, rerun with: -v
==2543== ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 0 from 0)
cccc 3$$
==2544==
==2544== HEAP SUMMARY:
==2544== in use at exit: 85,525 bytes in 1,061 blocks
==2544== total heap usage: 4,856 allocs, 3,795 frees, 26,012,621 bytes allocated
==2544==
==2544== 290 (240 direct, 50 indirect) bytes in 10 blocks are definitely lost in loss record 125 of 143
==2544== at 0x4C2DB9D: malloc (vg_replace_malloc.c:299)
==2544== by 0x41C2B0: ft_malloc (in /home/gwojda/42sh/42sh)
==2544== by 0x41BED3: ft_lstnew (in /home/gwojda/42sh/42sh)
==2544== by 0x41C0B9: push (in /home/gwojda/42sh/42sh)
==2544== by 0x40737F: exec_pushfds (in /home/gwojda/42sh/42sh)
==2544== by 0x407078: exec_init (in /home/gwojda/42sh/42sh)
==2544== by 0x4169BF: data_init (in /home/gwojda/42sh/42sh)
==2544== by 0x417450: shell_init (in /home/gwojda/42sh/42sh)
==2544== by 0x417051: main (in /home/gwojda/42sh/42sh)
==2544==
==2544== 2,297 (24 direct, 2,273 indirect) bytes in 1 blocks are definitely lost in loss record 138 of 143
==2544== at 0x4C2DB9D: malloc (vg_replace_malloc.c:299)
==2544== by 0x41C2B0: ft_malloc (in /home/gwojda/42sh/42sh)
==2544== by 0x41BED3: ft_lstnew (in /home/gwojda/42sh/42sh)
==2544== by 0x40F13C: job_addprocess (in /home/gwojda/42sh/42sh)
==2544== by 0x40716A: exec_leaf (in /home/gwojda/42sh/42sh)
==2544== by 0x4075F6: ft_exec (in /home/gwojda/42sh/42sh)
==2544== by 0x40728E: exec_pipe (in /home/gwojda/42sh/42sh)
==2544== by 0x4075F6: ft_exec (in /home/gwojda/42sh/42sh)
==2544== by 0x40728E: exec_pipe (in /home/gwojda/42sh/42sh)
==2544== by 0x4075F6: ft_exec (in /home/gwojda/42sh/42sh)
==2544== by 0x40728E: exec_pipe (in /home/gwojda/42sh/42sh)
==2544== by 0x4075F6: ft_exec (in /home/gwojda/42sh/42sh)
==2544==
==2544== LEAK SUMMARY:
==2544== definitely lost: 264 bytes in 11 blocks
==2544== indirectly lost: 2,323 bytes in 120 blocks
==2544== possibly lost: 0 bytes in 0 blocks
==2544== still reachable: 82,938 bytes in 930 blocks
==2544== suppressed: 0 bytes in 0 blocks
==2544== Reachable blocks (those to which a pointer was found) are not shown.
==2544== To see them, rerun with: --leak-check=full --show-leak-kinds=all
==2544==
==2544== For counts of detected and suppressed errors, rerun with: -v
==2544== ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 0 from 0)
cccc 4$
==2545==
==2545== HEAP SUMMARY:
==2545== in use at exit: 86,532 bytes in 1,113 blocks
==2545== total heap usage: 4,908 allocs, 3,795 frees, 26,013,628 bytes allocated
==2545==
==2545== 290 (240 direct, 50 indirect) bytes in 10 blocks are definitely lost in loss record 124 of 143
==2545== at 0x4C2DB9D: malloc (vg_replace_malloc.c:299)
==2545== by 0x41C2B0: ft_malloc (in /home/gwojda/42sh/42sh)
==2545== by 0x41BED3: ft_lstnew (in /home/gwojda/42sh/42sh)
==2545== by 0x41C0B9: push (in /home/gwojda/42sh/42sh)
==2545== by 0x40737F: exec_pushfds (in /home/gwojda/42sh/42sh)
==2545== by 0x407078: exec_init (in /home/gwojda/42sh/42sh)
==2545== by 0x4169BF: data_init (in /home/gwojda/42sh/42sh)
==2545== by 0x417450: shell_init (in /home/gwojda/42sh/42sh)
==2545== by 0x417051: main (in /home/gwojda/42sh/42sh)
==2545==
==2545== 3,304 (24 direct, 3,280 indirect) bytes in 1 blocks are definitely lost in loss record 138 of 143
==2545== at 0x4C2DB9D: malloc (vg_replace_malloc.c:299)
==2545== by 0x41C2B0: ft_malloc (in /home/gwojda/42sh/42sh)
==2545== by 0x41BED3: ft_lstnew (in /home/gwojda/42sh/42sh)
==2545== by 0x40F13C: job_addprocess (in /home/gwojda/42sh/42sh)
==2545== by 0x40716A: exec_leaf (in /home/gwojda/42sh/42sh)
==2545== by 0x4075F6: ft_exec (in /home/gwojda/42sh/42sh)
==2545== by 0x40728E: exec_pipe (in /home/gwojda/42sh/42sh)
==2545== by 0x4075F6: ft_exec (in /home/gwojda/42sh/42sh)
==2545== by 0x40728E: exec_pipe (in /home/gwojda/42sh/42sh)
==2545== by 0x4075F6: ft_exec (in /home/gwojda/42sh/42sh)
==2545== by 0x40728E: exec_pipe (in /home/gwojda/42sh/42sh)
==2545== by 0x4075F6: ft_exec (in /home/gwojda/42sh/42sh)
==2545==
==2545== LEAK SUMMARY:
==2545== definitely lost: 264 bytes in 11 blocks
==2545== indirectly lost: 3,330 bytes in 172 blocks
==2545== possibly lost: 0 bytes in 0 blocks
==2545== still reachable: 82,938 bytes in 930 blocks
==2545== suppressed: 0 bytes in 0 blocks
==2545== Reachable blocks (those to which a pointer was found) are not shown.
==2545== To see them, rerun with: --leak-check=full --show-leak-kinds=all
==2545==
==2545== For counts of detected and suppressed errors, rerun with: -v
==2545== ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 0 from 0)
cccc 5
==2546==
==2546== HEAP SUMMARY:
==2546== in use at exit: 87,539 bytes in 1,165 blocks
==2546== total heap usage: 4,960 allocs, 3,795 frees, 26,014,635 bytes allocated
==2546==
==2546== 290 (240 direct, 50 indirect) bytes in 10 blocks are definitely lost in loss record 124 of 145
==2546== at 0x4C2DB9D: malloc (vg_replace_malloc.c:299)
==2546== by 0x41C2B0: ft_malloc (in /home/gwojda/42sh/42sh)
==2546== by 0x41BED3: ft_lstnew (in /home/gwojda/42sh/42sh)
==2546== by 0x41C0B9: push (in /home/gwojda/42sh/42sh)
==2546== by 0x40737F: exec_pushfds (in /home/gwojda/42sh/42sh)
==2546== by 0x407078: exec_init (in /home/gwojda/42sh/42sh)
==2546== by 0x4169BF: data_init (in /home/gwojda/42sh/42sh)
==2546== by 0x417450: shell_init (in /home/gwojda/42sh/42sh)
==2546== by 0x417051: main (in /home/gwojda/42sh/42sh)
==2546==
==2546== 4,311 (24 direct, 4,287 indirect) bytes in 1 blocks are definitely lost in loss record 142 of 145
==2546== at 0x4C2DB9D: malloc (vg_replace_malloc.c:299)
==2546== by 0x41C2B0: ft_malloc (in /home/gwojda/42sh/42sh)
==2546== by 0x41BED3: ft_lstnew (in /home/gwojda/42sh/42sh)
==2546== by 0x40F13C: job_addprocess (in /home/gwojda/42sh/42sh)
==2546== by 0x40716A: exec_leaf (in /home/gwojda/42sh/42sh)
==2546== by 0x4075F6: ft_exec (in /home/gwojda/42sh/42sh)
==2546== by 0x40728E: exec_pipe (in /home/gwojda/42sh/42sh)
==2546== by 0x4075F6: ft_exec (in /home/gwojda/42sh/42sh)
==2546== by 0x40728E: exec_pipe (in /home/gwojda/42sh/42sh)
==2546== by 0x4075F6: ft_exec (in /home/gwojda/42sh/42sh)
==2546== by 0x40728E: exec_pipe (in /home/gwojda/42sh/42sh)
==2546== by 0x4075F6: ft_exec (in /home/gwojda/42sh/42sh)
==2546==
==2546== LEAK SUMMARY:
==2546== definitely lost: 264 bytes in 11 blocks
==2546== indirectly lost: 4,337 bytes in 224 blocks
==2546== possibly lost: 0 bytes in 0 blocks
==2546== still reachable: 82,938 bytes in 930 blocks
==2546== suppressed: 0 bytes in 0 blocks
==2546== Reachable blocks (those to which a pointer was found) are not shown.
==2546== To see them, rerun with: --leak-check=full --show-leak-kinds=all
==2546==
==2546== For counts of detected and suppressed errors, rerun with: -v
==2546== ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 0 from 0)