[PATCH] D124567: [dsymutil] Fix memory issue in the BinaryHolder

Vedant Kumar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 27 16:28:45 PDT 2022


vsk added inline comments.


================
Comment at: llvm/tools/dsymutil/BinaryHolder.cpp:231
   std::lock_guard<std::mutex> Lock(MemberCacheMutex);
-  MemberCache.try_emplace(Key, std::move(OE));
-  return MemberCache[Key];
+  MemberCache[Key] = std::move(OE);
+  return *MemberCache[Key];
----------------
JDevlieghere wrote:
> vsk wrote:
> > I think we can end up with two distinct ObjectEntry's (at different addresses) for the same {filename, timestamp} key, because archive loading is racy. Is that ok?
> That's a good point. I guess there's no better way to avoid that than by locking the during the whole loading sequence.
I can't think of a better option.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D124567/new/

https://reviews.llvm.org/D124567



More information about the llvm-commits mailing list