Skip to content

Commit

Permalink
Fix flappiness of test_refc_binaries
Browse files Browse the repository at this point in the history
In some circumstances, `erlang:memory(binary)` returns the space used by a refc binary from the previous test.
Ensure everything is cleaned up by calling gc before sending result.

Monitor wouldn’t help because monitor message is sent before mso is swept.

Also remove useless gc before the test as the process was freshly spawned.

Signed-off-by: Paul Guyot <[email protected]>
  • Loading branch information
pguyot authored Aug 3, 2023
1 parent 7d9a418 commit 3dcd6f7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tests/erlang_tests/test_refc_binaries.erl
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,6 @@ run_test(Fun) ->
end.

execute(Pid, Fun) ->
erlang:garbage_collect(),
Result =
try
Fun(),
Expand All @@ -245,6 +244,7 @@ execute(Pid, Fun) ->
_:Error ->
{error, Error}
end,
erlang:garbage_collect(),
Pid ! Result.

id(X) -> X.

0 comments on commit 3dcd6f7

Please sign in to comment.