www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 23106] New: the simple main() leaks 96 bytes

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

          Issue ID: 23106
           Summary: the simple main() leaks 96 bytes
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: minor
          Priority: P1
         Component: druntime
          Assignee: nobody puremagic.com
          Reporter: b2.temp gmx.com

```
module a;

int main()
{
    return 0;
}               
```

valgrind ./a

```
==1210593== For lists of detected and suppressed errors, rerun with: -s
==1210593== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
[basile pc temp]$ valgrind --leak-check=full --show-leak-kinds=all ./a
==1210595== Memcheck, a memory error detector
==1210595== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==1210595== Using Valgrind-3.16.1 and LibVEX; rerun with -h for copyright info
==1210595== Command: ./a
==1210595== 
==1210595== 
==1210595== HEAP SUMMARY:
==1210595==     in use at exit: 96 bytes in 2 blocks
==1210595==   total heap usage: 151 allocs, 149 frees, 15,080 bytes allocated
==1210595== 
==1210595== 24 bytes in 1 blocks are still reachable in loss record 1 of 2
==1210595==    at 0x4839747: malloc (vg_replace_malloc.c:306)
==1210595==    by 0x483BD32: realloc (vg_replace_malloc.c:834)
==1210595==    by 0x437361:
_D4core8internal9container6common8xreallocFNbNiPvmZQe (in
/home/basile/Bureau/temp/a)
==1210595==    by 0x445872:
_D4core8internal2gc4impl5protoQo7ProtoGC8addRangeMFNbNiPvmxC8TypeInfoZv (in
/home/basile/Bureau/temp/a)
==1210595==    by 0x43763B: gc_addRange (in /home/basile/Bureau/temp/a)
==1210595==    by 0x439441:
_D2rt6memory16initStaticDataGCFZ14__foreachbody1MFNbNiKSQCc19sections_elf_shared3DSOZi
(in /home/basile/Bureau/temp/a)
==1210595==    by 0x43B93F:
_D2rt19sections_elf_shared3DSO7opApplyFMDFKSQBqQBqQyZiZi (in
/home/basile/Bureau/temp/a)
==1210595==    by 0x4393E4: _D2rt6memory16initStaticDataGCFZv (in
/home/basile/Bureau/temp/a)
==1210595==    by 0x437EC4: rt_init (in /home/basile/Bureau/temp/a)
==1210595==    by 0x434B67: _D2rt6dmain212_d_run_main2UAAamPUQgZiZ6runAllMFZv
(in /home/basile/Bureau/temp/a)
==1210595==    by 0x434B04:
_D2rt6dmain212_d_run_main2UAAamPUQgZiZ7tryExecMFMDFZvZv (in
/home/basile/Bureau/temp/a)
==1210595==    by 0x434A65: _d_run_main2 (in /home/basile/Bureau/temp/a)
==1210595== 
==1210595== 72 bytes in 1 blocks are still reachable in loss record 2 of 2
==1210595==    at 0x483BCE8: realloc (vg_replace_malloc.c:834)
==1210595==    by 0x465FB5: _d_register_manual_gc (in
/home/basile/Bureau/temp/a)
==1210595==    by 0x46E69C: __libc_csu_init (in /home/basile/Bureau/temp/a)
==1210595==    by 0x4A2D16D: (below main) (in /usr/lib64/libc-2.32.so)
==1210595== 
==1210595== LEAK SUMMARY:
==1210595==    definitely lost: 0 bytes in 0 blocks
==1210595==    indirectly lost: 0 bytes in 0 blocks
==1210595==      possibly lost: 0 bytes in 0 blocks
==1210595==    still reachable: 96 bytes in 2 blocks
==1210595==         suppressed: 0 bytes in 0 blocks
==1210595== 
==1210595== For lists of detected and suppressed errors, rerun with: -s
==1210595== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
```

seems to be caused by the gc initialization

--
May 12 2022