Skip to content

Commit 9f44b25

Browse files
committed
fix manual gc collect so it actually sweeps something
1 parent b7ff87c commit 9f44b25

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

cjetreconstruction/src/cjetreconstruction-finder.cc

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,6 @@ int main(int argc, char *argv[]) {
122122
exit(EXIT_FAILURE);
123123
}
124124

125-
std::cout << "Previous GC state: " << jl_gc_is_enabled() << std::endl;
126-
jl_gc_enable(gc_option->count());
127-
std::cout << "Current GC state: " << jl_gc_is_enabled() << std::endl;
128125
// read in input events
129126
//----------------------------------------------------------
130127
auto events = read_input_events(input_file.c_str(), maxevents);
@@ -196,8 +193,10 @@ int main(int argc, char *argv[]) {
196193
double time_lowest = 1.0e20;
197194
for (long trial = 0; trial < trials; ++trial) {
198195
std::cout << "Trial " << trial << " ";
199-
if (jl_gc_is_enabled() == 0) {
200-
jl_gc_collect(JL_GC_FULL);
196+
if (!gc_option->count()) {
197+
jl_gc_enable(1); // collect actually sweeps only with enabled gc
198+
jl_gc_collect(JL_GC_AUTO); // FULL takes longer without any visible change to timing of measured code
199+
jl_gc_enable(0);
201200
}
202201
auto start_t = std::chrono::steady_clock::now();
203202
for (size_t ievt = skip_events_option->value(); ievt < events.size(); ++ievt) {

0 commit comments

Comments
 (0)