We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
-1073740940
orc
useMalloc
import std/os #import std/strformat import strutils type ObjRef = ref object of RootObj data: int remark: string parent: ObjRef children: seq[ObjRef] proc test(o: ObjRef, i: int) = #echo "data = ", o.data var o = new(ObjRef) o.data = i #o.remark = fmt"*ObjRef*#{i}Foo-bar-foo-bar-foo-bar#{i}" var c = ObjRef(data: i + 1) o.children.add(c) c.parent = o o.children = @[] proc printDiagnostics() = echo("Total memory available: " & formatSize(getTotalMem()) & " bytes") echo("Free memory: " & formatSize(getFreeMem()) & " bytes") echo("Occupied memory: " & formatSize(getOccupiedMem()) & " bytes") proc main = var o: ObjRef #i = 0 n = 100000000 #a = initSinglyLinkedList[ObjRef]() a = newSeq[ObjRef]() #while i <= n: for i in 1 .. n + 1: #inc i o = new(ObjRef) o.data = i #o.remark = fmt"ObjRef#{i}Foo-bar-foo-bar-foo-bar#{i}" var c = ObjRef(data: i + 1) o.children.add(c) c.parent = o; o.test(i) a.add(o) if i mod 1000_0000 == 0: #a = initSinglyLinkedList[ObjRef]() for item in a: item.children = @[] a = @[] if i mod 10000000 == 0: echo "i = ", i o.test(i) printDiagnostics(); main() const STM = 1000 for i in 1 .. 1800: printDiagnostics(); echo $i & ". Sleep " & $STM & "ms" sleep(STM) echo "Bye!"
nim -v Nim Compiler Version 1.6.20 [Windows: amd64] Compiled at 2024-04-07 Copyright (c) 2006-2023 by Andreas Rumpf
active boot switches: -d:release
%nim20_home%\bin\nim -v Nim Compiler Version 2.0.8 [Windows: amd64] Compiled at 2024-07-03 Copyright (c) 2006-2023 by Andreas Rumpf
>%nim20_home%\bin\nim c -d:release --mm:orc -d:useMalloc --stackTrace:on objtest.nim >objtest >echo %errorlevel% -1073740940
>%nim20_home%\bin\nim c -d:release --mm:orc --stackTrace:on objtest.nim >objtest i = 10000000 Total memory available: 2.363GiB bytes Free memory: 2.191GiB bytes Occupied memory: 175.993MiB bytes i = 20000000 Total memory available: 2.789GiB bytes Free memory: 2.531GiB bytes Occupied memory: 263.997MiB bytes i = 30000000 Total memory available: 2.789GiB bytes Free memory: 2.531GiB bytes Occupied memory: 263.997MiB bytes ...
No response
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Test source
Nim Version
active boot switches: -d:release
active boot switches: -d:release
Current Output
Expected Output
Known Workarounds
No response
Additional Information
No response
The text was updated successfully, but these errors were encountered: