Skip to content

Commit

Permalink
EL9 warning fix: use mallinfo2 for glibc>=2.33
Browse files Browse the repository at this point in the history
  • Loading branch information
smuzaffar committed May 2, 2022
1 parent f62ece4 commit 952022f
Showing 1 changed file with 19 additions and 7 deletions.
26 changes: 19 additions & 7 deletions FWCore/Services/plugins/SimpleMemoryCheck.cc
Expand Up @@ -548,14 +548,18 @@ namespace edm {
eventStatOutput("LargestIncreaseRssEvent", eventDeltaRssT1_, reportData);

#ifdef __linux__
#if (__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 33)
struct mallinfo2 minfo = mallinfo2();
#else
struct mallinfo minfo = mallinfo();
reportData.insert(std::make_pair("HEAP_ARENA_SIZE_BYTES", i2str(minfo.arena)));
reportData.insert(std::make_pair("HEAP_ARENA_N_UNUSED_CHUNKS", i2str(minfo.ordblks)));
reportData.insert(std::make_pair("HEAP_TOP_FREE_BYTES", i2str(minfo.keepcost)));
reportData.insert(std::make_pair("HEAP_MAPPED_SIZE_BYTES", i2str(minfo.hblkhd)));
reportData.insert(std::make_pair("HEAP_MAPPED_N_CHUNKS", i2str(minfo.hblks)));
reportData.insert(std::make_pair("HEAP_USED_BYTES", i2str(minfo.uordblks)));
reportData.insert(std::make_pair("HEAP_UNUSED_BYTES", i2str(minfo.fordblks)));
#endif
reportData.insert(std::make_pair("HEAP_ARENA_SIZE_BYTES", std::to_string(minfo.arena)));
reportData.insert(std::make_pair("HEAP_ARENA_N_UNUSED_CHUNKS", std::to_string(minfo.ordblks)));
reportData.insert(std::make_pair("HEAP_TOP_FREE_BYTES", std::to_string(minfo.keepcost)));
reportData.insert(std::make_pair("HEAP_MAPPED_SIZE_BYTES", std::to_string(minfo.hblkhd)));
reportData.insert(std::make_pair("HEAP_MAPPED_N_CHUNKS", std::to_string(minfo.hblks)));
reportData.insert(std::make_pair("HEAP_USED_BYTES", std::to_string(minfo.uordblks)));
reportData.insert(std::make_pair("HEAP_UNUSED_BYTES", std::to_string(minfo.fordblks)));
#endif

// Report Growth rates for VSize and Rss
Expand Down Expand Up @@ -642,7 +646,11 @@ namespace edm {
if (eventDeltaRssT1_.deltaRss > 0)
eventStatOutput("LargestIncreaseRssEvent", eventDeltaRssT1_, reportData);

#if (__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 33)
struct mallinfo2 minfo = mallinfo2();
#else
struct mallinfo minfo = mallinfo();
#endif
reportData.push_back(mallOutput("HEAP_ARENA_SIZE_BYTES", minfo.arena));
reportData.push_back(mallOutput("HEAP_ARENA_N_UNUSED_CHUNKS", minfo.ordblks));
reportData.push_back(mallOutput("HEAP_TOP_FREE_BYTES", minfo.keepcost));
Expand Down Expand Up @@ -835,7 +843,11 @@ namespace edm {
<< deltaRSS;
} else {
#ifdef __linux__
#if (__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 33)
struct mallinfo2 minfo = mallinfo2();
#else
struct mallinfo minfo = mallinfo();
#endif
#endif
LogWarning("MemoryCheck") << "MemoryCheck: " << type << " " << mdname << ":" << mdlabel << " VSIZE "
<< current_->vsize << " " << deltaVSIZE << " RSS " << current_->rss << " "
Expand Down

0 comments on commit 952022f

Please sign in to comment.