nim-lang / Nim

Nim is a statically typed compiled systems programming language. It combines successful concepts from mature languages like Python, Ada and Modula. Its design focuses on efficiency, expressiveness, and elegance (in that order of priority).
https://nim-lang.org
Other
16.63k stars 1.47k forks source link

Memory leak under Arc/Orc on inline iterators with nested seq. #24402

Closed lilkeet closed 2 weeks ago

lilkeet commented 3 weeks ago

Description

On the arc, orc, and atomicArc mm's: Inline iterators that do not return a lent type leak memory when iterating upon nested sequences. Closures that do not return lent types and inlines that do return lent types do not leak.

iterator myPairsInline*[T](twoDarray: seq[seq[T]]): (int, seq[T]) {.inline.} =
  for indexValuePair in twoDarray.pairs:
    yield indexValuePair

iterator myPairsClosure*[T](twoDarray: seq[seq[T]]): (int, seq[T]) {.closure.} =
  for indexValuePair in twoDarray.pairs:
    yield indexValuePair

template testTotalMem(iter: untyped): int =
  proc innerTestTotalMem(): int {.gensym.} =
    result = 0

    # do the same operation 100 times, which should have similar mem footprint
    # as doing it once.
    for iterNum in 0..100:
      result = max(result, getTotalMem()) # record current mem footprint

      # initialize nested sequence
      var my2dArray: seq[seq[int32]] = @[]

      # fill with some data...
      for i in 0'i32..10_000:
        var z = @[i, i+1]
        my2dArray.add z

      # use that data somehow...
      var otherContainer: seq[int32] = @[]
      var count = 0'i32
      for oneDindex, innerArray in my2dArray.iter:
        for value in innerArray:
          inc count
          if oneDindex > 50 and value < 200:
            otherContainer.add count

  innerTestTotalMem()

proc main =
  let closureMem = testTotalMem(myPairsClosure) #1052672
  let inlineMem = testTotalMem(myPairsInline) #20328448

  when defined(echoFootprint):
    echo "Closure memory footprint: " & $closureMem
    echo "Inline memory footprint: " & $inlineMem

  # check that mem footprint is relatively similar b/t each method
  doAssert (closureMem - inlineMem).abs < (closureMem div 10)

main()

Nim Version

Nim Compiler Version 2.2.0 [Linux: amd64]

Current Output

/path/to/mainmodule.nim(49) mainmodule
/path/to/mainmodule.nim(47) main
/path/to/.choosenim/toolchains/nim-2.2.0/lib/std/assertions.nim(41) failedAssertImpl
/path/to/.choosenim/toolchains/nim-2.2.0/lib/std/assertions.nim(36) raiseAssert
/path/to/.choosenim/toolchains/nim-2.2.0/lib/system/fatal.nim(53) sysFatal
Error: unhandled exception: /path/to/mainmodule.nim(47, 3) `(closureMem - inlineMem).abs < (closureMem div 10)`  [AssertionDefect]
Error: execution of an external program failed: '/path/to/mainmodule'

Expected Output

No response

Known Workarounds

No response

Additional Information

The regions gc/mm scheme is the only other gc that fails this example.

lilkeet commented 3 weeks ago

Here's valgrind's output on above example when nim is passed -d:useMalloc and the mm scheme is orc.

 HEAP SUMMARY:
     in use at exit: 16,161,616 bytes in 1,010,101 blocks
   total heap usage: 5,055,657 allocs, 4,045,556 frees, 187,586,304 bytes allocated

 Searching for pointers to 1,010,101 not-freed blocks
 Checked 108,560 bytes

 16 bytes in 1 blocks are still reachable in loss record 1 of 2
    at 0x4846828: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
    by 0x10AFC8: allocImpl__system_u1742 (in /path/to/mainmodule)
    by 0x10AFEE: allocSharedImpl (in /path/to/mainmodule)
    by 0x10DD04: alignedAlloc__system_u1882 (in /path/to/mainmodule)
    by 0x10E014: newSeqPayloadUninit (in /path/to/mainmodule)
    by 0x10E28C: prepareSeqAddUninit (in /path/to/mainmodule)
    by 0x1125A9: setLen__mainmodule_u129 (in /path/to/mainmodule)
    by 0x11369A: eqdup___mainmodule_u115 (in /path/to/mainmodule)
    by 0x114E11: innerTestTotalMemmyPairsInline__mainmodule_u451 (in /path/to/mainmodule)
    by 0x11534F: main__mainmodule_u20 (in /path/to/mainmodule)
    by 0x115592: NimMainModule (in /path/to/mainmodule)
    by 0x1154CA: NimMainInner (in /path/to/mainmodule)

 16,161,600 bytes in 1,010,100 blocks are definitely lost in loss record 2 of 2
    at 0x4846828: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
    by 0x10AFC8: allocImpl__system_u1742 (in /path/to/mainmodule)
    by 0x10AFEE: allocSharedImpl (in /path/to/mainmodule)
    by 0x10DD04: alignedAlloc__system_u1882 (in /path/to/mainmodule)
    by 0x10E014: newSeqPayloadUninit (in /path/to/mainmodule)
    by 0x10E28C: prepareSeqAddUninit (in /path/to/mainmodule)
    by 0x1125A9: setLen__mainmodule_u129 (in /path/to/mainmodule)
    by 0x11369A: eqdup___mainmodule_u115 (in /path/to/mainmodule)
    by 0x114E11: innerTestTotalMemmyPairsInline__mainmodule_u451 (in /path/to/mainmodule)
    by 0x11534F: main__mainmodule_u20 (in /path/to/mainmodule)
    by 0x115592: NimMainModule (in /path/to/mainmodule)
    by 0x1154CA: NimMainInner (in /path/to/mainmodule)

 LEAK SUMMARY:
    definitely lost: 16,161,600 bytes in 1,010,100 blocks
    indirectly lost: 0 bytes in 0 blocks
      possibly lost: 0 bytes in 0 blocks
    still reachable: 16 bytes in 1 blocks
                       of which reachable via heuristic:
                         newarray           : 16 bytes in 1 blocks
         suppressed: 0 bytes in 0 blocks

 ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
ringabout commented 3 weeks ago

!nim c --gc:orc

iterator myPairsInline*[T](twoDarray: seq[seq[T]]): (int, seq[T]) {.inline.} =
  for indexValuePair in twoDarray.pairs:
    yield indexValuePair

iterator myPairsClosure*[T](twoDarray: seq[seq[T]]): (int, seq[T]) {.closure.} =
  for indexValuePair in twoDarray.pairs:
    yield indexValuePair

template testTotalMem(iter: untyped): int =
  proc innerTestTotalMem(): int {.gensym.} =
    result = 0

    # do the same operation 100 times, which should have similar mem footprint
    # as doing it once.
    for iterNum in 0..100:
      result = max(result, getTotalMem()) # record current mem footprint

      # initialize nested sequence
      var my2dArray: seq[seq[int32]] = @[]

      # fill with some data...
      for i in 0'i32..10_000:
        var z = @[i, i+1]
        my2dArray.add z

      # use that data somehow...
      var otherContainer: seq[int32] = @[]
      var count = 0'i32
      for oneDindex, innerArray in my2dArray.iter:
        for value in innerArray:
          inc count
          if oneDindex > 50 and value < 200:
            otherContainer.add count

  innerTestTotalMem()

proc main =
  let closureMem = testTotalMem(myPairsClosure) #1052672
  let inlineMem = testTotalMem(myPairsInline) #20328448

  when defined(echoFootprint):
    echo "Closure memory footprint: " & $closureMem
    echo "Inline memory footprint: " & $inlineMem

  # check that mem footprint is relatively similar b/t each method
  doAssert (closureMem - inlineMem).abs < (closureMem div 10)

main()
juancarlospaco commented 2 weeks ago

!nim c --gc:orc -d:useMalloc

iterator myPairsInline*[T](twoDarray: seq[seq[T]]): (int, seq[T]) {.inline.} =
  for indexValuePair in twoDarray.pairs:
    yield indexValuePair

iterator myPairsClosure*[T](twoDarray: seq[seq[T]]): (int, seq[T]) {.closure.} =
  for indexValuePair in twoDarray.pairs:
    yield indexValuePair

template testTotalMem(iter: untyped): int =
  proc innerTestTotalMem(): int {.gensym.} =
    result = 0

    # do the same operation 100 times, which should have similar mem footprint
    # as doing it once.
    for iterNum in 0..100:
      result = max(result, getTotalMem()) # record current mem footprint

      # initialize nested sequence
      var my2dArray: seq[seq[int32]] = @[]

      # fill with some data...
      for i in 0'i32..10_000:
        var z = @[i, i+1]
        my2dArray.add z

      # use that data somehow...
      var otherContainer: seq[int32] = @[]
      var count = 0'i32
      for oneDindex, innerArray in my2dArray.iter:
        for value in innerArray:
          inc count
          if oneDindex > 50 and value < 200:
            otherContainer.add count

  innerTestTotalMem()

proc main =
  let closureMem = testTotalMem(myPairsClosure) #1052672
  let inlineMem = testTotalMem(myPairsInline) #20328448

  when defined(echoFootprint):
    echo "Closure memory footprint: " & $closureMem
    echo "Inline memory footprint: " & $inlineMem

  # check that mem footprint is relatively similar b/t each method
  doAssert (closureMem - inlineMem).abs < (closureMem div 10)

main()
github-actions[bot] commented 2 weeks ago
:penguin: Linux bisect by @juancarlospaco (collaborator)
devel :-1: FAIL

Output

``` loc.nim:5) ==2551== by 0x10BC4C: allocSharedImpl (malloc.nim:34) ==2551== by 0x10FFC0: system::alignedAlloc(range09223372036854775807, range09223372036854775807) (memalloc.nim:331) ==2551== by 0x110AED: newSeqPayloadUninit (seqs_v2.nim:76) ==2551== by 0x110BD2: prepareSeqAddUninit (seqs_v2.nim:110) ==2551== by 0x1141B7: system::setLen(var >, range09223372036854775807) (seqs_v2.nim:182) ==2551== by 0x1150E6: temp::eqdup_(seq) (iterators.nim:187) ==2551== by 0x115C40: main::innerTestTotalMemX60gensym6_ (iterators.nim:190) ==2551== ==2551== 4,848 bytes in 101 blocks are still reachable in loss record 5 of 8 ==2551== at 0x484DA83: calloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so) ==2551== by 0x10BC87: system::alloc0Impl(range09223372036854775807) (malloc.nim:11) ==2551== by 0x11216D: system::cellSetPut(var, uInt) (cellsets.nim:154) ==2551== by 0x113269: system::incl(var, ptr) (cellsets.nim:175) ==2551== by 0x1133E0: nimRawDispose (arc.nim:185) ==2551== by 0x1134EF: nimDestroyAndDispose (arc.nim:204) ==2551== by 0x115566: myPairsClosure::eqdestroy_(ref) (temp.nim:29) ==2551== by 0x11580A: main::innerTestTotalMemX60gensym0_ (temp.nim:23) ==2551== by 0x115ED2: temp::main (temp.nim:34) ==2551== ==2551== 8,192 bytes in 1 blocks are still reachable in loss record 6 of 8 ==2551== at 0x484DA83: calloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so) ==2551== by 0x10BC87: system::alloc0Impl(range09223372036854775807) (malloc.nim:11) ==2551== by 0x10C138: system::init(var) (cellsets.nim:92) ==2551== by 0x11342D: nimRawDispose (arc.nim:188) ==2551== by 0x1134EF: nimDestroyAndDispose (arc.nim:204) ==2551== by 0x115566: myPairsClosure::eqdestroy_(ref) (temp.nim:29) ==2551== by 0x11580A: main::innerTestTotalMemX60gensym0_ (temp.nim:23) ==2551== by 0x115ED2: temp::main (temp.nim:34) ==2551== by 0x11604A: NimMainModule (temp.nim:37) ==2551== ==2551== 8,192 (8,080 direct, 112 indirect) bytes in 101 blocks are definitely lost in loss record 7 of 8 ==2551== at 0x484DA83: calloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so) ==2551== by 0x10BC87: system::alloc0Impl(range09223372036854775807) (malloc.nim:11) ==2551== by 0x10BD7B: system::allocShared0Impl(range09223372036854775807) (malloc.nim:37) ==2551== by 0x10FCF9: system::alignedAlloc0(range09223372036854775807, range09223372036854775807) (memalloc.nim:351) ==2551== by 0x10C7CD: nimNewObj (arc.nim:104) ==2551== by 0x1156C8: main::innerTestTotalMemX60gensym0_ (temp.nim:25) ==2551== by 0x115ED2: temp::main (temp.nim:34) ==2551== by 0x11604A: NimMainModule (temp.nim:37) ==2551== by 0x116098: NimMainInner (temp.nim:79) ==2551== ==2551== 16,161,488 bytes in 1,010,093 blocks are definitely lost in loss record 8 of 8 ==2551== at 0x4848899: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so) ==2551== by 0x10BC3A: system::allocImpl(range09223372036854775807) (malloc.nim:5) ==2551== by 0x10BC4C: allocSharedImpl (malloc.nim:34) ==2551== by 0x10FFC0: system::alignedAlloc(range09223372036854775807, range09223372036854775807) (memalloc.nim:331) ==2551== by 0x110AED: newSeqPayloadUninit (seqs_v2.nim:76) ==2551== by 0x110BD2: prepareSeqAddUninit (seqs_v2.nim:110) ==2551== by 0x1141B7: system::setLen(var >, range09223372036854775807) (seqs_v2.nim:182) ==2551== by 0x1150E6: temp::eqdup_(seq) (iterators.nim:187) ==2551== by 0x115C40: main::innerTestTotalMemX60gensym6_ (iterators.nim:190) ==2551== ==2551== ERROR SUMMARY: 8 errors from 8 contexts (suppressed: 0 from 0) ``` Filesize 436.18 Kb (446,648 bytes) Duration 24 mins
stable :-1: FAIL

Output

``` im:5) ==2616== by 0x10BC4C: allocSharedImpl (malloc.nim:34) ==2616== by 0x10FFB7: system::alignedAlloc(range09223372036854775807, range09223372036854775807) (memalloc.nim:331) ==2616== by 0x110AE7: newSeqPayloadUninit (seqs_v2.nim:55) ==2616== by 0x110BCC: prepareSeqAddUninit (seqs_v2.nim:106) ==2616== by 0x1141F3: system::setLen(var >, range09223372036854775807) (seqs_v2.nim:178) ==2616== by 0x115122: temp::eqdup_(seq) (iterators.nim:185) ==2616== by 0x115C7C: main::innerTestTotalMemX60gensym6_ (iterators.nim:185) ==2616== ==2616== 4,848 bytes in 101 blocks are still reachable in loss record 5 of 8 ==2616== at 0x484DA83: calloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so) ==2616== by 0x10BC87: system::alloc0Impl(range09223372036854775807) (malloc.nim:11) ==2616== by 0x112195: system::cellSetPut(var, uInt) (cellsets.nim:154) ==2616== by 0x1132A5: system::incl(var, ptr) (cellsets.nim:173) ==2616== by 0x11341C: nimRawDispose (arc.nim:185) ==2616== by 0x11352B: nimDestroyAndDispose (arc.nim:204) ==2616== by 0x1155A2: myPairsClosure::eqdestroy_(ref) (temp.nim:24) ==2616== by 0x115846: main::innerTestTotalMemX60gensym0_ (temp.nim:23) ==2616== by 0x115F0E: temp::main (temp.nim:31) ==2616== ==2616== 8,192 bytes in 1 blocks are still reachable in loss record 6 of 8 ==2616== at 0x484DA83: calloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so) ==2616== by 0x10BC87: system::alloc0Impl(range09223372036854775807) (malloc.nim:11) ==2616== by 0x10C138: system::init(var) (cellsets.nim:92) ==2616== by 0x113469: nimRawDispose (arc.nim:185) ==2616== by 0x11352B: nimDestroyAndDispose (arc.nim:204) ==2616== by 0x1155A2: myPairsClosure::eqdestroy_(ref) (temp.nim:24) ==2616== by 0x115846: main::innerTestTotalMemX60gensym0_ (temp.nim:23) ==2616== by 0x115F0E: temp::main (temp.nim:31) ==2616== by 0x116086: NimMainModule (temp.nim:37) ==2616== ==2616== 8,192 (8,080 direct, 112 indirect) bytes in 101 blocks are definitely lost in loss record 7 of 8 ==2616== at 0x484DA83: calloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so) ==2616== by 0x10BC87: system::alloc0Impl(range09223372036854775807) (malloc.nim:11) ==2616== by 0x10BD7B: system::allocShared0Impl(range09223372036854775807) (malloc.nim:37) ==2616== by 0x10FCF0: system::alignedAlloc0(range09223372036854775807, range09223372036854775807) (memalloc.nim:351) ==2616== by 0x10C7CD: nimNewObj (arc.nim:96) ==2616== by 0x115704: main::innerTestTotalMemX60gensym0_ (temp.nim:23) ==2616== by 0x115F0E: temp::main (temp.nim:31) ==2616== by 0x116086: NimMainModule (temp.nim:37) ==2616== by 0x1160D4: NimMainInner (temp.nim:62) ==2616== ==2616== 16,161,488 bytes in 1,010,093 blocks are definitely lost in loss record 8 of 8 ==2616== at 0x4848899: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so) ==2616== by 0x10BC3A: system::allocImpl(range09223372036854775807) (malloc.nim:5) ==2616== by 0x10BC4C: allocSharedImpl (malloc.nim:34) ==2616== by 0x10FFB7: system::alignedAlloc(range09223372036854775807, range09223372036854775807) (memalloc.nim:331) ==2616== by 0x110AE7: newSeqPayloadUninit (seqs_v2.nim:55) ==2616== by 0x110BCC: prepareSeqAddUninit (seqs_v2.nim:106) ==2616== by 0x1141F3: system::setLen(var >, range09223372036854775807) (seqs_v2.nim:178) ==2616== by 0x115122: temp::eqdup_(seq) (iterators.nim:185) ==2616== by 0x115C7C: main::innerTestTotalMemX60gensym6_ (iterators.nim:185) ==2616== ==2616== ERROR SUMMARY: 8 errors from 8 contexts (suppressed: 0 from 0) ``` Filesize 453.08 Kb (463,952 bytes) Duration 23 mins
2.0.10 :-1: FAIL

Output

``` oc.nim:5) ==2761== by 0x10BC4C: allocSharedImpl (malloc.nim:34) ==2761== by 0x10FFB7: system::alignedAlloc(range09223372036854775807, range09223372036854775807) (memalloc.nim:331) ==2761== by 0x110AE7: newSeqPayloadUninit (seqs_v2.nim:57) ==2761== by 0x110BCC: prepareSeqAddUninit (seqs_v2.nim:108) ==2761== by 0x1141E8: system::setLen(var >, range09223372036854775807) (seqs_v2.nim:180) ==2761== by 0x1150FD: temp::eqdup_(seq) (iterators.nim:185) ==2761== by 0x115C46: main::innerTestTotalMemX60gensym6_ (iterators.nim:185) ==2761== ==2761== 4,848 bytes in 101 blocks are still reachable in loss record 5 of 8 ==2761== at 0x484DA83: calloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so) ==2761== by 0x10BC87: system::alloc0Impl(range09223372036854775807) (malloc.nim:11) ==2761== by 0x112195: system::cellSetPut(var, uInt) (cellsets.nim:154) ==2761== by 0x1132A5: system::incl(var, ptr) (cellsets.nim:173) ==2761== by 0x11341C: nimRawDispose (arc.nim:168) ==2761== by 0x11352B: nimDestroyAndDispose (arc.nim:187) ==2761== by 0x11556C: myPairsClosure::eqdestroy_(ref) (temp.nim:24) ==2761== by 0x115810: main::innerTestTotalMemX60gensym0_ (temp.nim:23) ==2761== by 0x115ED8: temp::main (temp.nim:31) ==2761== ==2761== 8,192 bytes in 1 blocks are still reachable in loss record 6 of 8 ==2761== at 0x484DA83: calloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so) ==2761== by 0x10BC87: system::alloc0Impl(range09223372036854775807) (malloc.nim:11) ==2761== by 0x10C138: system::init(var) (cellsets.nim:92) ==2761== by 0x113469: nimRawDispose (arc.nim:168) ==2761== by 0x11352B: nimDestroyAndDispose (arc.nim:187) ==2761== by 0x11556C: myPairsClosure::eqdestroy_(ref) (temp.nim:24) ==2761== by 0x115810: main::innerTestTotalMemX60gensym0_ (temp.nim:23) ==2761== by 0x115ED8: temp::main (temp.nim:31) ==2761== by 0x116050: NimMainModule (temp.nim:37) ==2761== ==2761== 8,192 (8,080 direct, 112 indirect) bytes in 101 blocks are definitely lost in loss record 7 of 8 ==2761== at 0x484DA83: calloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so) ==2761== by 0x10BC87: system::alloc0Impl(range09223372036854775807) (malloc.nim:11) ==2761== by 0x10BD7B: system::allocShared0Impl(range09223372036854775807) (malloc.nim:37) ==2761== by 0x10FCF0: system::alignedAlloc0(range09223372036854775807, range09223372036854775807) (memalloc.nim:351) ==2761== by 0x10C7CD: nimNewObj (arc.nim:81) ==2761== by 0x1156CE: main::innerTestTotalMemX60gensym0_ (temp.nim:23) ==2761== by 0x115ED8: temp::main (temp.nim:31) ==2761== by 0x116050: NimMainModule (temp.nim:37) ==2761== by 0x11609E: NimMainInner (temp.nim:62) ==2761== ==2761== 16,161,488 bytes in 1,010,093 blocks are definitely lost in loss record 8 of 8 ==2761== at 0x4848899: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so) ==2761== by 0x10BC3A: system::allocImpl(range09223372036854775807) (malloc.nim:5) ==2761== by 0x10BC4C: allocSharedImpl (malloc.nim:34) ==2761== by 0x10FFB7: system::alignedAlloc(range09223372036854775807, range09223372036854775807) (memalloc.nim:331) ==2761== by 0x110AE7: newSeqPayloadUninit (seqs_v2.nim:57) ==2761== by 0x110BCC: prepareSeqAddUninit (seqs_v2.nim:108) ==2761== by 0x1141E8: system::setLen(var >, range09223372036854775807) (seqs_v2.nim:180) ==2761== by 0x1150FD: temp::eqdup_(seq) (iterators.nim:185) ==2761== by 0x115C46: main::innerTestTotalMemX60gensym6_ (iterators.nim:185) ==2761== ==2761== ERROR SUMMARY: 8 errors from 8 contexts (suppressed: 0 from 0) ``` Filesize 484.95 Kb (496,584 bytes) Duration 24 mins
2.0.0 :-1: FAIL

Output

``` by 0x115A2D: innerTestTotalMemX60gensym6___temp_u530 (iterators.nim:177) ==2837== ==2837== 4,848 bytes in 101 blocks are still reachable in loss record 5 of 8 ==2837== at 0x484DA83: calloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so) ==2837== by 0x10BC68: alloc0Impl__system_u1763 (malloc.nim:11) ==2837== by 0x1103F7: cellSetPut__system_u2715 (cellsets.nim:154) ==2837== by 0x10C4B1: incl__system_u2780 (cellsets.nim:173) ==2837== by 0x10C628: nimRawDispose (arc.nim:168) ==2837== by 0x10F4FD: nimDestroyAndDispose (arc.nim:187) ==2837== by 0x115337: eqdestroy___temp_u643 (temp.nim:24) ==2837== by 0x1155DB: innerTestTotalMemX60gensym0___temp_u32 (temp.nim:23) ==2837== by 0x115D09: main__temp_u21 (temp.nim:31) ==2837== ==2837== 8,192 bytes in 1 blocks are still reachable in loss record 6 of 8 ==2837== at 0x484DA83: calloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so) ==2837== by 0x10BC68: alloc0Impl__system_u1763 (malloc.nim:11) ==2837== by 0x10F022: init__system_u2617 (cellsets.nim:92) ==2837== by 0x10C675: nimRawDispose (arc.nim:168) ==2837== by 0x10F4FD: nimDestroyAndDispose (arc.nim:187) ==2837== by 0x115337: eqdestroy___temp_u643 (temp.nim:24) ==2837== by 0x1155DB: innerTestTotalMemX60gensym0___temp_u32 (temp.nim:23) ==2837== by 0x115D09: main__temp_u21 (temp.nim:31) ==2837== by 0x115E81: NimMainModule (temp.nim:37) ==2837== ==2837== 8,192 (8,080 direct, 112 indirect) bytes in 101 blocks are definitely lost in loss record 7 of 8 ==2837== at 0x484DA83: calloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so) ==2837== by 0x10BC68: alloc0Impl__system_u1763 (malloc.nim:11) ==2837== by 0x10BC7A: allocShared0Impl__system_u1776 (malloc.nim:37) ==2837== by 0x110FAE: alignedAlloc0__system_u1947 (memalloc.nim:351) ==2837== by 0x113193: nimNewObj (arc.nim:81) ==2837== by 0x115499: innerTestTotalMemX60gensym0___temp_u32 (temp.nim:23) ==2837== by 0x115D09: main__temp_u21 (temp.nim:31) ==2837== by 0x115E81: NimMainModule (temp.nim:37) ==2837== by 0x115ECF: NimMainInner (temp.nim:62) ==2837== ==2837== 16,161,488 bytes in 1,010,093 blocks are definitely lost in loss record 8 of 8 ==2837== at 0x484DA83: calloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so) ==2837== by 0x10BC68: alloc0Impl__system_u1763 (malloc.nim:11) ==2837== by 0x10BC7A: allocShared0Impl__system_u1776 (malloc.nim:37) ==2837== by 0x110FAE: alignedAlloc0__system_u1947 (memalloc.nim:351) ==2837== by 0x1110F5: newSeqPayload (seqs_v2.nim:44) ==2837== by 0x1115FE: prepareSeqAdd (seqs_v2.nim:62) ==2837== by 0x113F77: setLen__temp_u131 (seqs_v2.nim:133) ==2837== by 0x114EA2: eqdup___temp_u117 (iterators.nim:177) ==2837== by 0x115A2D: innerTestTotalMemX60gensym6___temp_u530 (iterators.nim:177) ==2837== ==2837== ERROR SUMMARY: 8 errors from 8 contexts (suppressed: 0 from 0) ``` Filesize 433.79 Kb (444,200 bytes) Duration 24 mins
1.6.20 :-1: FAIL

Output

``` FF: prepareSeqAdd (seqs_v2.nim:57) ==2907== by 0x113C06: setLen::setLen(var >, range09223372036854775807) (seqs_v2.nim:125) ==2907== by 0x114D30: innerTestTotalMemX60gensym0_::eqcopy_(var >, seq) (seqs_v2.nim:114) ==2907== by 0x115717: main::innerTestTotalMemX60gensym6_ (seqs_v2.nim:114) ==2907== by 0x115A06: temp::main (temp.nim:31) ==2907== ==2907== 4,848 bytes in 101 blocks are still reachable in loss record 5 of 8 ==2907== at 0x484DA83: calloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so) ==2907== by 0x109F89: system::alloc0Impl(range09223372036854775807) (malloc.nim:11) ==2907== by 0x10FC36: system::cellSetPut(var, uInt) (cellsets.nim:154) ==2907== by 0x10C872: system::incl(var, ptr) (cellsets.nim:173) ==2907== by 0x10C9D5: nimRawDispose (arc.nim:161) ==2907== by 0x10CAD9: nimDestroyAndDispose (arc.nim:180) ==2907== by 0x114CCE: myPairsClosure::eqdestroy_(var >) (temp.nim:23) ==2907== by 0x11525C: main::innerTestTotalMemX60gensym0_ (temp.nim:23) ==2907== by 0x1159F5: temp::main (temp.nim:30) ==2907== ==2907== 8,192 bytes in 1 blocks are still reachable in loss record 6 of 8 ==2907== at 0x484DA83: calloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so) ==2907== by 0x109F89: system::alloc0Impl(range09223372036854775807) (malloc.nim:11) ==2907== by 0x10A43C: system::init(var) (cellsets.nim:92) ==2907== by 0x10CA1E: nimRawDispose (arc.nim:160) ==2907== by 0x10CAD9: nimDestroyAndDispose (arc.nim:180) ==2907== by 0x114CCE: myPairsClosure::eqdestroy_(var >) (temp.nim:23) ==2907== by 0x11525C: main::innerTestTotalMemX60gensym0_ (temp.nim:23) ==2907== by 0x1159F5: temp::main (temp.nim:30) ==2907== by 0x115B46: NimMainModule (temp.nim:37) ==2907== ==2907== 8,192 (8,080 direct, 112 indirect) bytes in 101 blocks are definitely lost in loss record 7 of 8 ==2907== at 0x484DA83: calloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so) ==2907== by 0x109F89: system::alloc0Impl(range09223372036854775807) (malloc.nim:11) ==2907== by 0x10DD4F: system::alignedAlloc0(range09223372036854775807, range09223372036854775807) (memalloc.nim:353) ==2907== by 0x10D01B: nimNewObj (arc.nim:86) ==2907== by 0x115132: main::innerTestTotalMemX60gensym0_ (system.nim:263) ==2907== by 0x1159F5: temp::main (temp.nim:30) ==2907== by 0x115B46: NimMainModule (temp.nim:37) ==2907== by 0x115B93: NimMainInner (temp.nim:56) ==2907== by 0x115C13: NimMain (temp.nim:61) ==2907== ==2907== 16,161,472 bytes in 1,010,092 blocks are definitely lost in loss record 8 of 8 ==2907== at 0x484DA83: calloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so) ==2907== by 0x109F89: system::alloc0Impl(range09223372036854775807) (malloc.nim:11) ==2907== by 0x10DD4F: system::alignedAlloc0(range09223372036854775807, range09223372036854775807) (memalloc.nim:353) ==2907== by 0x10EFEA: newSeqPayload (seqs_v2.nim:38) ==2907== by 0x10FDFF: prepareSeqAdd (seqs_v2.nim:57) ==2907== by 0x113C06: setLen::setLen(var >, range09223372036854775807) (seqs_v2.nim:125) ==2907== by 0x114D30: innerTestTotalMemX60gensym0_::eqcopy_(var >, seq) (seqs_v2.nim:114) ==2907== by 0x115717: main::innerTestTotalMemX60gensym6_ (seqs_v2.nim:114) ==2907== by 0x115A06: temp::main (temp.nim:31) ==2907== ==2907== ERROR SUMMARY: 8 errors from 8 contexts (suppressed: 0 from 0) ``` Filesize 437.60 Kb (448,104 bytes) Duration 22 mins
1.4.8 :-1: FAIL

Output

``` ``` Filesize 437.60 Kb (448,104 bytes) Duration
1.2.18 :-1: FAIL

Output

``` ``` Filesize 437.60 Kb (448,104 bytes) Duration
1.0.10 :-1: FAIL

Output

``` ``` Filesize 437.60 Kb (448,104 bytes) Duration
Stats
  • GCC 11.4.0
  • Clang 14.0.0
  • NodeJS 20.4
  • Created 2024-11-10T18:41:11Z
  • Comments 3
  • Commands nim c --gc:orc -d:useMalloc -d:nimArcDebug -d:nimArcIds -d:nimAllocPagesViaMalloc -d:useSysAssert -d:useGcAssert -d:nimLeakDetector --debugger:native --debuginfo:on -d:nimDebug -d:nimDebugDlOpen -d:ssl -d:nimDisableCertificateValidation --forceBuild:on --colors:off --verbosity:0 --hints:off --lineTrace:off --nimcache:/home/runner/work/Nim/Nim --out:/home/runner/work/Nim/Nim/temp /home/runner/work/Nim/Nim/temp.nim && valgrind /home/runner/work/Nim/Nim/temp

:robot: Bug found in 42 mins bisecting 8 commits at 0 commits per second