Skip to content

Commit b121ddf

Browse files
committed
Pause MaxMemoryPreload for edmplugincache file reading in PluginManager
In a local developer area with many packages checked out, the PluginManager cache can be tens of megabytes larger than in a developer area without packages being checked out. This difference can result in false positive warnings in MaxMemoryPreload monitoring in PR tests. An easy way (even if hacky) out is to exclude the PluginManager cache from the MaxMemoryPreload monitoring.
1 parent 09ebaf9 commit b121ddf

File tree

3 files changed

+31
-0
lines changed

3 files changed

+31
-0
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#include "PauseMaxMemoryPreloadSentry.h"
2+
3+
// By default do nothing, but add "hooks" that MaxMemoryPreload can
4+
// override with LD_PRELOAD
5+
void pauseMaxMemoryPreload() {}
6+
void unpauseMaxMemoryPreload() {}
7+
8+
namespace edm {
9+
PauseMaxMemoryPreloadSentry::PauseMaxMemoryPreloadSentry() { pauseMaxMemoryPreload(); }
10+
PauseMaxMemoryPreloadSentry::~PauseMaxMemoryPreloadSentry() { unpauseMaxMemoryPreload(); }
11+
} // namespace edm
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#ifndef FWCore_PluginManager_src_PauseMaxMemoryPreloadSentry_h
2+
#define FWCore_PluginManager_src_PauseMaxMemoryPreloadSentry_h
3+
4+
namespace edm {
5+
class PauseMaxMemoryPreloadSentry {
6+
public:
7+
PauseMaxMemoryPreloadSentry();
8+
~PauseMaxMemoryPreloadSentry();
9+
10+
PauseMaxMemoryPreloadSentry(const PauseMaxMemoryPreloadSentry&) = delete;
11+
PauseMaxMemoryPreloadSentry(PauseMaxMemoryPreloadSentry&&) = delete;
12+
PauseMaxMemoryPreloadSentry& operator=(const PauseMaxMemoryPreloadSentry&) = delete;
13+
PauseMaxMemoryPreloadSentry& operator=(PauseMaxMemoryPreloadSentry&&) = delete;
14+
};
15+
} // namespace edm
16+
17+
#endif

FWCore/PluginManager/src/PluginManager.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929
#include "FWCore/Utilities/interface/Exception.h"
3030
#include "FWCore/Utilities/interface/thread_safety_macros.h"
3131

32+
#include "PauseMaxMemoryPreloadSentry.h"
33+
3234
namespace edmplugin {
3335
//
3436
// constants, enums and typedefs
@@ -47,6 +49,7 @@ namespace edmplugin {
4749
throw cms::Exception("PluginMangerCacheProblem")
4850
<< "Unable to open the cache file '" << cacheFile.string() << "'. Please check permissions on file";
4951
}
52+
edm::PauseMaxMemoryPreloadSentry pauseSentry;
5053
CacheParser::read(file, dir, categoryToInfos);
5154
return true;
5255
}

0 commit comments

Comments
 (0)