Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EL9 warning fix: use mallinfo2 for glibc>=2.33 #37768

Merged
merged 1 commit into from
May 3, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 19 additions & 7 deletions FWCore/Services/plugins/SimpleMemoryCheck.cc
Original file line number Diff line number Diff line change
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