-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* use genRefAssign when assign to sink string * add test case
- Loading branch information
Showing
2 changed files
with
29 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
discard """ | ||
cmd: '''nim c --gc:refc -r $file''' | ||
""" | ||
const Memo = 100 * 1024 | ||
|
||
proc fff(v: sink string): iterator(): char = | ||
return iterator(): char = | ||
for c in v: | ||
yield c | ||
|
||
var tmp = newString(Memo) | ||
|
||
let iter = fff(move(tmp)) | ||
|
||
while true: | ||
let v = iter() | ||
if finished(iter): | ||
break | ||
|
||
doAssert getOccupiedMem() < Memo * 3 |