Skip to content
Snippets Groups Projects
Commit 1fc9c8ee authored by François  LAURENT's avatar François LAURENT
Browse files

half the number of calls to gc

parent 2aed6459
No related branches found
No related tags found
No related merge requests found
Pipeline #104309 passed
......@@ -193,7 +193,7 @@ function countlabels(repository, window; unload=false)
counts′[label] = get(counts′, label, 0) + 1
end
end
unload && unload!(file)
unload && unload!(file; gc=true)
lock(c)
try
counts[file] = counts′
......@@ -501,8 +501,8 @@ function sample(f, loader::DataLoader, features=:spine; kwargs...)
Threads.foreach(ch) do (i, file, state)
segments = sample(file, loader.window, loader.index, features; kwargs...)
f(i, file, state, filter(!isnothing, segments))
empty!(segments) # `unload!` calls `GC.gc`
unload!(file)
empty!(segments)
unload!(file; gc=true)
end
end
......
......@@ -539,20 +539,20 @@ end
Unload timeseries data to free memory space.
"""
function unload!(file::Formats.JSONLabels)
function unload!(file::Formats.JSONLabels; gc=false)
for dep in file.dependencies
unload!(dep)
end
empty!(file.dependencies)
empty!(file.timeseries)
empty!(file.run)
GC.gc()
gc && GC.gc()
return file
end
function unload!(file)
function unload!(file; gc=false)
empty!(file.timeseries)
empty!(file.run)
GC.gc()
gc && GC.gc()
return file
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment