Skip to content

Commit 41f06c2

Browse files
Remove double free
The GC is already going to be freeing this so the `empty!` call is unnecessary. The bigger issue is that this can free the memory, and then the GC can try and free the memory, and if those collide it can segfault. `empty!` does have a check in there to try and make that not occur, but that seems to be failing with the newer Sundials binaries, so it's probably better/safer to just use the tie-in to the GC anyways.
1 parent 55b7c74 commit 41f06c2

File tree

1 file changed

+0
-4
lines changed

1 file changed

+0
-4
lines changed

src/simple.jl

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,6 @@ function kinsol(
8383
strategy = KIN_NONE
8484
flag = @checkflag KINSol(kmem, y, strategy, scale, scale) true
8585

86-
empty!(kmem)
87-
8886
return y
8987
end
9088

@@ -181,7 +179,6 @@ function cvode!(
181179
c = c + 1
182180
end
183181

184-
empty!(mem)
185182
Sundials.SUNLinSolFree_Dense(LS)
186183
Sundials.SUNMatDestroy_Dense(A)
187184

@@ -277,7 +274,6 @@ function idasol(
277274
ypres[k, :] = yp
278275
end
279276

280-
empty!(mem)
281277
Sundials.SUNLinSolFree_Dense(LS)
282278
Sundials.SUNMatDestroy_Dense(A)
283279

0 commit comments

Comments
 (0)