Skip to content

Commit 64a3da5

Browse files
committed
Merge branch 'topic/leak_test' into 'master'
Fix memory leak in test. See merge request eng/libadalang/adasat!19
2 parents b1dd7ff + da72222 commit 64a3da5

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

testsuite/tests/huge_formula/test.adb

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
-- related to the number of variables to solve for.
55

66
with Ada.Text_IO; use Ada.Text_IO;
7+
with Ada.Unchecked_Deallocation;
78

89
with AdaSAT.Formulas;
910
with AdaSAT.Helpers;
@@ -12,10 +13,15 @@ procedure Test is
1213
use AdaSAT;
1314
use AdaSAT.Formulas;
1415

16+
type Model_Access is access Model;
17+
18+
procedure Free is new Ada.Unchecked_Deallocation
19+
(Model, Model_Access);
20+
1521
Var_Count : constant := 1_000_000;
1622

1723
F : Formula;
18-
M : access Model := new Model'(1 .. Var_Count => Unset);
24+
M : Model_Access := new Model'(1 .. Var_Count => Unset);
1925
begin
2026
F.Append (new Literal_Array'((+1, +Var_Count)));
2127
for I in Variable (2) .. Var_Count loop
@@ -26,4 +32,5 @@ begin
2632
else
2733
Put_Line ("Failed solving");
2834
end if;
35+
Free (M);
2936
end Test;

0 commit comments

Comments
 (0)