Index: src/profile-generator.cc |
diff --git a/src/profile-generator.cc b/src/profile-generator.cc |
index 1c6c902a4dcd9c7abe5e5eddb6aac11d5b108484..2de7a2fb912ae8a444524a9ca5ce7f27ee207d65 100644 |
--- a/src/profile-generator.cc |
+++ b/src/profile-generator.cc |
@@ -492,6 +492,10 @@ CpuProfilesCollection::~CpuProfilesCollection() { |
bool CpuProfilesCollection::StartProfiling(const char* title, unsigned uid) { |
ASSERT(uid > 0); |
current_profiles_semaphore_->Wait(); |
+ if (current_profiles_.length() >= kMaxSimultaneousProfiles) { |
+ current_profiles_semaphore_->Signal(); |
+ return false; |
+ } |
for (int i = 0; i < current_profiles_.length(); ++i) { |
if (strcmp(current_profiles_[i]->title(), title) == 0) { |
// Ignore attempts to start profile with the same title. |