Skip to content

Commit 41637db

Browse files
ringaboutnarimiran
authored andcommitted
fixes ORC memory leaks; marks hooks with optQuirky (nim-lang#24701)
closes nim-lang#24686 closes nim-lang#24693 ```nim # v.nim import std/[json] var test: seq[string] var testData: JsonNode try: ## Fails testData = parseJson("""[{"id": 1"}, {"id": "2"}]""") ## Works # testdata = parseJson("""[{"id": "1"}, {"id": "2"}]""") ## Fails # let stream = newStringStream("""[{"id": 1"}, {"id": "2"}]""") # testData = parseJson(stream, "input", false, false) # stream.close() except: testData = %* [] for t in testData: test.add(t["id"].getStr()) echo $test ``` With this PR: ``` ==66425== LEAK SUMMARY: ==66425== definitely lost: 0 bytes in 0 blocks ==66425== indirectly lost: 0 bytes in 0 blocks ==66425== possibly lost: 0 bytes in 0 blocks ==66425== still reachable: 16,512 bytes in 2 blocks ==66425== suppressed: 0 bytes in 0 blocks ==66425== Reachable blocks (those to which a pointer was found) are not shown. ==66425== To see them, rerun with: --leak-check=full --show-leak-kinds=all ==66425== ==66425== For lists of detected and suppressed errors, rerun with: -s ==66425== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0) ``` (cherry picked from commit f0b5bf3)
1 parent b7eefc3 commit 41637db

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

compiler/liftdestructors.nim

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1179,6 +1179,8 @@ proc produceSym(g: ModuleGraph; c: PContext; typ: PType; kind: TTypeAttachedOp;
11791179
result.ast[pragmasPos].add newTree(nkExprColonExpr,
11801180
newIdentNode(g.cache.getIdent("raises"), info), newNodeI(nkBracket, info))
11811181

1182+
if kind == attachedDestructor:
1183+
incl result.options, optQuirky
11821184
completePartialOp(g, idgen.module, typ, kind, result)
11831185

11841186

0 commit comments

Comments
 (0)