Thread overview
[Issue 23106] the simple main() leaks 72 bytes
[Issue 23106] the simple main() leaks 96 bytes
Dec 17, 2022
Iain Buclaw
Jul 14
Basile-z
Jul 14
Basile-z
Apr 05
Dennis
December 17, 2022
https://issues.dlang.org/show_bug.cgi?id=23106

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P1                          |P3

--
July 14
https://issues.dlang.org/show_bug.cgi?id=23106

Basile-z <b2.temp@gmx.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|the simple main() leaks 96  |the simple main() leaks 72
                   |bytes                       |bytes

--
July 14
https://issues.dlang.org/show_bug.cgi?id=23106

--- Comment #1 from Basile-z <b2.temp@gmx.com> ---
==117347== Memcheck, a memory error detector
==117347== Copyright (C) 2002-2022, and GNU GPL'd, by Julian Seward et al.
==117347== Using Valgrind-3.21.0 and LibVEX; rerun with -h for copyright info
==117347== Command: /tmp/temp_7F336C18C4D0
==117347==
==117347== realloc() with size 0
==117347==    at 0x4848A40: realloc (vg_replace_malloc.c:1649)
==117347==    by 0x4389F1: rt.minfo.ModuleGroup.sortCtors(immutable(char)[])
(in /tmp/temp_7F336C18C4D0)
==117347==    by 0x439608: rt.minfo.ModuleGroup.sortCtors() (in
/tmp/temp_7F336C18C4D0)
==117347==    by 0x4398DC: rt.minfo.rt_moduleCtor().__foreachbody1(ref
rt.sections_elf_shared.DSO) (in /tmp/temp_7F336C18C4D0)
==117347==    by 0x439D31: rt.sections_elf_shared.DSO.opApply(scope int(ref
rt.sections_elf_shared.DSO) delegate) (in /tmp/temp_7F336C18C4D0)
==117347==    by 0x4398BC: rt_moduleCtor (in /tmp/temp_7F336C18C4D0)
==117347==    by 0x436F39: rt_init (in /tmp/temp_7F336C18C4D0)
==117347==    by 0x433BD7: rt.dmain2._d_run_main2(char[][], ulong, extern(C)
int(char[][]) function).runAll() (in /tmp/temp_7F336C18C4D0)
==117347==    by 0x433B75: rt.dmain2._d_run_main2(char[][], ulong, extern(C)
int(char[][]) function).tryExec(scope void() delegate) (in
/tmp/temp_7F336C18C4D0)
==117347==    by 0x433ADE: _d_run_main2 (in /tmp/temp_7F336C18C4D0)
==117347==    by 0x4338C7: _d_run_main (in /tmp/temp_7F336C18C4D0)
==117347==    by 0x4337E1: main (entrypoint.d:29)
==117347==  Address 0x4b50c00 is 0 bytes inside a block of size 104 alloc'd
==117347==    at 0x484382F: malloc (vg_replace_malloc.c:431)
==117347==    by 0x438947: rt.minfo.ModuleGroup.sortCtors(immutable(char)[])
(in /tmp/temp_7F336C18C4D0)
==117347==    by 0x439608: rt.minfo.ModuleGroup.sortCtors() (in
/tmp/temp_7F336C18C4D0)
==117347==    by 0x4398DC: rt.minfo.rt_moduleCtor().__foreachbody1(ref
rt.sections_elf_shared.DSO) (in /tmp/temp_7F336C18C4D0)
==117347==    by 0x439D31: rt.sections_elf_shared.DSO.opApply(scope int(ref
rt.sections_elf_shared.DSO) delegate) (in /tmp/temp_7F336C18C4D0)
==117347==    by 0x4398BC: rt_moduleCtor (in /tmp/temp_7F336C18C4D0)
==117347==    by 0x436F39: rt_init (in /tmp/temp_7F336C18C4D0)
==117347==    by 0x433BD7: rt.dmain2._d_run_main2(char[][], ulong, extern(C)
int(char[][]) function).runAll() (in /tmp/temp_7F336C18C4D0)
==117347==    by 0x433B75: rt.dmain2._d_run_main2(char[][], ulong, extern(C)
int(char[][]) function).tryExec(scope void() delegate) (in
/tmp/temp_7F336C18C4D0)
==117347==    by 0x433ADE: _d_run_main2 (in /tmp/temp_7F336C18C4D0)
==117347==    by 0x4338C7: _d_run_main (in /tmp/temp_7F336C18C4D0)
==117347==    by 0x4337E1: main (entrypoint.d:29)
==117347==
==117347==
==117347== HEAP SUMMARY:
==117347==     in use at exit: 72 bytes in 2 blocks
==117347==   total heap usage: 101 allocs, 99 frees, 9,040 bytes allocated
==117347==
==117347== LEAK SUMMARY:
==117347==    definitely lost: 0 bytes in 0 blocks
==117347==    indirectly lost: 0 bytes in 0 blocks
==117347==      possibly lost: 0 bytes in 0 blocks
==117347==    still reachable: 72 bytes in 2 blocks
==117347==         suppressed: 0 bytes in 0 blocks
==117347== Rerun with --leak-check=full to see details of leaked memory
==117347==
==117347== For lists of detected and suppressed errors, rerun with: -s
==117347== ERROR SUMMARY: 16 errors from 1 contexts (suppressed: 0 from 0)
[basile@pc styx]$

--
April 05
https://issues.dlang.org/show_bug.cgi?id=23106

Dennis <dkorpel@live.nl> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dkorpel@live.nl

--- Comment #2 from Dennis <dkorpel@live.nl> ---
Since we now have proper valgrind support including a test in the test suite (https://github.com/dlang/dmd/pull/15304), can you still reproduce this?

--
April 10
https://issues.dlang.org/show_bug.cgi?id=23106

Alisa Lain <al1-ce@list.ru> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |al1-ce@list.ru

--- Comment #3 from Alisa Lain <al1-ce@list.ru> ---
I'm not the author of this issue, but I can still replicate it. Same thing 72 bytes.

Compiling with both dmd and dub produces this leak and turning on -betterC switch fixes issue.

Also, just a note, changing compiler to LDC makes it even worse (going to
report on their repo).

--