Skip to content

Commit 998c620

Browse files
neildharfacebook-github-bot
authored andcommitted
Fix domain tracking
Summary: We cannot assume that the pointers in `domains_` are in sorted order, since they may be updated by the GC. Use a linear search instead. Reviewed By: dulinriley Differential Revision: D26111515 fbshipit-source-id: 3b473ef5eb7776bd637ce14c92f1cc2d1d6b2f4d
1 parent b071ba5 commit 998c620

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

lib/VM/Profiler/SamplingProfilerPosix.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,9 @@ void SamplingProfiler::GlobalProfiler::unregisterRuntime(
6060

6161
void SamplingProfiler::registerDomain(Domain *domain) {
6262
// If domain is not already registered, add it to the list.
63-
auto it = std::lower_bound(domains_.begin(), domains_.end(), domain);
64-
if (it == domains_.end() || *it != domain)
65-
domains_.insert(it, domain);
63+
auto it = std::find(domains_.begin(), domains_.end(), domain);
64+
if (it == domains_.end())
65+
domains_.push_back(domain);
6666
}
6767

6868
void SamplingProfiler::markRoots(RootAcceptor &acceptor) {

0 commit comments

Comments
 (0)