scoped memory management (#14790)
* fixes the regressions * closes #13936 * scope based memory management implemented * enabled tcontrolflow.nim test case * final cleanups
This commit is contained in:
parent
695154970d
commit
1854d29781
17 changed files with 611 additions and 477 deletions
|
|
@ -14,7 +14,7 @@ type
|
|||
p: int
|
||||
MyObjRef = ref MyObj
|
||||
|
||||
proc `=destroy`(x: var MyObj) =
|
||||
proc `=destroy`(x: var MyObj) =
|
||||
if x.p != 0:
|
||||
echo "destroyed"
|
||||
|
||||
|
|
@ -48,16 +48,16 @@ proc thread5(x: sink MyObjRef): MyObjRef =
|
|||
os.sleep(1000)
|
||||
result = x
|
||||
|
||||
proc ref_forwarding_test =
|
||||
proc ref_forwarding_test =
|
||||
var x = new(MyObj)
|
||||
x[].p = 2
|
||||
var y = spawn thread4(x)
|
||||
|
||||
proc ref_sink_forwarding_test =
|
||||
|
||||
proc ref_sink_forwarding_test =
|
||||
var x = new(MyObj)
|
||||
x[].p = 2
|
||||
var y = spawn thread5(x)
|
||||
|
||||
ref_forwarding_test()
|
||||
ref_sink_forwarding_test()
|
||||
ref_sink_forwarding_test()
|
||||
sync()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue