juancarlospaco / nimrun-action-minefield

Minefield
1 stars 0 forks source link

TESTING #7

Open juancarlospaco opened 1 week ago

juancarlospaco commented 1 week ago

TESTING ONLY.

juancarlospaco commented 1 week 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 1 week ago
:penguin: Linux bisect by @juancarlospaco (owner)
devel :-1: FAIL

Output

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

Output

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

Output

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

Output

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

Output

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

Output

``` ``` Filesize 437.91 Kb (448,416 bytes) Duration
1.2.18 :-1: FAIL

Output

``` ``` Filesize 437.91 Kb (448,416 bytes) Duration
1.0.10 :-1: FAIL

Output

``` ``` Filesize 437.91 Kb (448,416 bytes) Duration
Stats
  • GCC 11.4.0
  • Clang 14.0.0
  • NodeJS 20.4
  • Created 2024-11-10T18:33:37Z
  • Comments 1
  • 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/nimrun-action-minefield/nimrun-action-minefield --out:/home/runner/work/nimrun-action-minefield/nimrun-action-minefield/temp /home/runner/work/nimrun-action-minefield/nimrun-action-minefield/temp.nim && valgrind /home/runner/work/nimrun-action-minefield/nimrun-action-minefield/temp

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