Skip to content

Commit 787582f

Browse files
authored
Merge pull request #209 from NathanKolbow/master
Fix for the slow but constant increase in memory usage
2 parents f46226c + b84ac74 commit 787582f

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/snaq_optimization.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1241,7 +1241,9 @@ function optTopLevel!(currT::HybridNetwork, liktolAbs::Float64, Nfail::Integer,
12411241
writeTopologyLevel1(newT,true)
12421242
end
12431243
writelog && write(logfile, "\nBegins heuristic optimization of network------\n")
1244+
loopcount = 0
12441245
while(absDiff > liktolAbs && failures < Nfail && currT.loglik > liktolAbs && stillmoves) #stops if close to zero because of new deviance form of the pseudolik
1246+
if (loopcount % 50) == 0 GC.gc() end
12451247
if CHECKNET && !isempty(d.repSpecies)
12461248
checkTop4multAllele(currT) || error("currT is not good for multiple alleles")
12471249
end
@@ -1308,6 +1310,7 @@ function optTopLevel!(currT::HybridNetwork, liktolAbs::Float64, Nfail::Integer,
13081310
stillmoves = false
13091311
end
13101312
@debug "--------- loglik_$(count) end: earlier log can be discarded ----"
1313+
loopcount += 1
13111314
end
13121315
if ftolAbs > 1e-7 || ftolRel > 1e-7 || xtolAbs > 1e-7 || xtolRel > 1e-7
13131316
writelog && write(logfile,"\nfound best network, now we re-optimize branch lengths and gamma more precisely")

0 commit comments

Comments
 (0)