-
Notifications
You must be signed in to change notification settings - Fork 423
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Jade Abraham <[email protected]>
- Loading branch information
1 parent
431c2da
commit 5d4f573
Showing
6 changed files
with
74 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{id = 2} | ||
deinit C id=2 | ||
{id = 4} | ||
deinit C id=4 | ||
(id = 2) | ||
deinit R id=2 | ||
deinit R id=2 | ||
deinit R id=1 | ||
(id = 4) | ||
deinit R id=4 | ||
deinit R id=4 | ||
deinit R id=3 | ||
|
||
=================================================== Memory Leaks ==================================================== | ||
Allocated Memory (Bytes) Number Size Total Description Address | ||
===================================================================================================================== | ||
iter-memory-leak-unpack.chpl:26 1 16 16 C prediffed | ||
iter-memory-leak-unpack.chpl:26 1 16 16 C prediffed | ||
===================================================================================================================== | ||
|
31 changes: 31 additions & 0 deletions
31
test/functions/iterators/bugs/iter-memory-leak-unpack.chpl
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,31 @@ | ||
class C { | ||
var id: int; | ||
proc deinit() { | ||
writeln("deinit C id=", id); | ||
} | ||
} | ||
|
||
record R { | ||
var id: int; | ||
proc deinit() { | ||
writeln("deinit R id=", id); | ||
} | ||
} | ||
|
||
iter foo() { | ||
yield (new C(1), new C(2)); | ||
yield (new C(3), new C(4)); | ||
} | ||
|
||
iter bar() { | ||
yield (new R(1), new R(2)); | ||
yield (new R(3), new R(4)); | ||
} | ||
|
||
|
||
for (_, x) in foo() { | ||
writeln(x); | ||
} | ||
for (_, x) in bar() { | ||
writeln(x); | ||
} |
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 @@ | ||
--memLeaks |
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,2 @@ | ||
bug: ignoring a value in a tuple unpack doesn't invoke the destructor | ||
#25926 |
16 changes: 16 additions & 0 deletions
16
test/functions/iterators/bugs/iter-memory-leak-unpack.good
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,16 @@ | ||
{id = 2} | ||
deinit C id=2 | ||
deinit C id=1 | ||
{id = 4} | ||
deinit C id=4 | ||
deinit C id=3 | ||
(id = 2) | ||
deinit R id=2 | ||
deinit R id=1 | ||
deinit R id=2 | ||
deinit R id=1 | ||
(id = 4) | ||
deinit R id=4 | ||
deinit R id=3 | ||
deinit R id=4 | ||
deinit R id=3 |
4 changes: 4 additions & 0 deletions
4
test/functions/iterators/bugs/iter-memory-leak-unpack.prediff
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,4 @@ | ||
#!/bin/bash | ||
|
||
sed -E "s/0x[0-9a-f]*/prediffed/" <$2 >$2.predifftmp | ||
mv $2.predifftmp $2 |