Skip to content

Commit

Permalink
Limit concurrent destruction
Browse files Browse the repository at this point in the history
Summary: A recent change caused excessive parallelism during the RedexContext destruction. This is being fixed here, by clearing concurrent containers sequentially (as part of the already ongoing massively parallel destruction effort).

Reviewed By: agampe

Differential Revision: D50819506

fbshipit-source-id: e08de44047bd6970ae6c85b694bc80bd3f931573
  • Loading branch information
Nikolai Tillmann authored and facebook-github-bot committed Nov 1, 2023
1 parent 45e81c6 commit 64fad48
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
1 change: 1 addition & 0 deletions libredex/PassManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
#include "ScopedMetrics.h"
#include "Show.h"
#include "SourceBlocks.h"
#include "ThreadPool.h"
#include "Timer.h"
#include "Walkers.h"

Expand Down
9 changes: 6 additions & 3 deletions libredex/RedexContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,14 @@ RedexContext::~RedexContext() {
s_type_map.clear();
},
[&] {
Timer timer("DexTypeLists", /* indent */ false);
Timer timer("Delete DexTypeLists", /* indent */ false);
for (auto const& p : s_typelist_map) {
delete p.second;
}
s_typelist_map.clear();
},
[&] {
Timer timer("Delete DexProtos.", /* indent */ false);
Timer timer("Delete DexProtos", /* indent */ false);
for (auto* proto : s_proto_set) {
delete proto;
}
Expand Down Expand Up @@ -185,7 +185,10 @@ RedexContext::~RedexContext() {
for (size_t i = 0; i < s_small_string_set.size(); ++i) {
auto* small_string_set = s_small_string_set[i];
small_strings_size += small_string_set->size();
fns.push_back([small_string_set]() { delete small_string_set; });
fns.push_back([small_string_set]() {
small_string_set->clear();
delete small_string_set;
});
}
for (auto& segment : s_large_string_set) {
large_strings_size += segment.size();
Expand Down

0 comments on commit 64fad48

Please sign in to comment.