CMS 3D CMS Logo

Macros | Functions
memory_proxies.cc File Reference
#include <memory>
#include <cassert>
#include <atomic>
#include <cstddef>
#include <malloc.h>
#include "PerfTools/AllocMonitor/interface/AllocMonitorRegistry.h"
#include "FWCore/Utilities/interface/thread_safety_macros.h"
#include <dlfcn.h>
#include <new>

Go to the source code of this file.

Macros

#define CPP_MEM_OVERRIDE
 
#define USE_LOCAL_MALLOC
 

Functions

void * aligned_alloc (size_t alignment, size_t size) noexcept
 
void alloc_monitor_start ()
 
void alloc_monitor_stop ()
 
void * calloc (size_t nitems, size_t item_size) noexcept
 
void free (void *ptr) noexcept
 
void * malloc (size_t size) noexcept
 
void * memalign (size_t alignment, size_t size) noexcept
 
void operator delete (void *ptr) noexcept
 
void operator delete (void *ptr, std::align_val_t al) noexcept
 
void operator delete (void *ptr, std::size_t sz) noexcept
 
void operator delete (void *ptr, std::size_t sz, std::align_val_t al) noexcept
 
void operator delete (void *ptr, const std::nothrow_t &tag) noexcept
 
void operator delete (void *ptr, std::align_val_t al, const std::nothrow_t &tag) noexcept
 
void operator delete[] (void *ptr) noexcept
 
void operator delete[] (void *ptr, std::align_val_t al) noexcept
 
void operator delete[] (void *ptr, std::size_t sz) noexcept
 
void operator delete[] (void *ptr, std::size_t sz, std::align_val_t al) noexcept
 
void operator delete[] (void *ptr, const std::nothrow_t &tag) noexcept
 
void operator delete[] (void *ptr, std::align_val_t al, const std::nothrow_t &tag) noexcept
 
void * operator new (std::size_t size)
 
void * operator new (std::size_t size, std::align_val_t al)
 
void * operator new (std::size_t size, const std::nothrow_t &tag) noexcept
 
void * operator new (std::size_t size, std::align_val_t al, const std::nothrow_t &tag) noexcept
 
void * operator new[] (std::size_t size)
 
void * operator new[] (std::size_t size, std::align_val_t al)
 
void * operator new[] (std::size_t size, const std::nothrow_t &tag) noexcept
 
void * operator new[] (std::size_t size, std::align_val_t al, const std::nothrow_t &tag) noexcept
 
int posix_memalign (void **memptr, size_t alignment, size_t size) noexcept
 
void * realloc (void *ptr, size_t size) noexcept
 

Macro Definition Documentation

◆ CPP_MEM_OVERRIDE

#define CPP_MEM_OVERRIDE

Definition at line 231 of file memory_proxies.cc.

◆ USE_LOCAL_MALLOC

#define USE_LOCAL_MALLOC

Definition at line 13 of file memory_proxies.cc.

Function Documentation

◆ aligned_alloc()

void* aligned_alloc ( size_t  alignment,
size_t  size 
)
noexcept

Definition at line 166 of file memory_proxies.cc.

References myMessageLogger_cff::alignment, CMS_SA_ALLOW, cms::perftools::AllocMonitorRegistry::instance(), definitions::original, and runTheMatrix::ret.

Referenced by Matriplex::aligned_alloc64(), aligned_allocator< T, Alignment >::allocate(), and cms::cuda::make_host_unique().

166  {
167  CMS_SA_ALLOW static const auto original = get<decltype(&::aligned_alloc)>("aligned_alloc");
168  if (not alloc_monitor_running_state()) {
169  return original(alignment, size);
170  }
171 
172  auto& reg = AllocMonitorRegistry::instance();
173  return reg.allocCalled(
174  size,
175  [alignment, size]() { return original(alignment, size); },
176  [](auto ret) { return malloc_usable_size(ret); });
177 }
size
Write out results.
#define CMS_SA_ALLOW
static PFTauRenderPlugin instance
ret
prodAgent to be discontinued

◆ alloc_monitor_start()

void alloc_monitor_start ( )

Definition at line 89 of file memory_proxies.cc.

Referenced by cms::perftools::AllocMonitorRegistry::start().

89 { alloc_monitor_running_state() = true; }

◆ alloc_monitor_stop()

void alloc_monitor_stop ( )

Definition at line 90 of file memory_proxies.cc.

Referenced by cms::perftools::AllocMonitorRegistry::~AllocMonitorRegistry().

90 { alloc_monitor_running_state() = false; }

◆ calloc()

void* calloc ( size_t  nitems,
size_t  item_size 
)
noexcept

Definition at line 107 of file memory_proxies.cc.

References init, cms::perftools::AllocMonitorRegistry::instance(), definitions::original, and runTheMatrix::ret.

Referenced by cree_mat(), cree_mat_prod(), FWColorManager::initColorTable(), and readRemote().

107  {
108  const auto original = Originals::calloc;
109  Originals::init();
110  if (not alloc_monitor_running_state()) {
111  return original(nitems, item_size);
112  }
113  auto& reg = AllocMonitorRegistry::instance();
114  return reg.allocCalled(
115  nitems * item_size,
116  [nitems, item_size, original]() { return original(nitems, item_size); },
117  [](auto ret) { return malloc_usable_size(ret); });
118 }
static PFTauRenderPlugin instance
ret
prodAgent to be discontinued
int init
Definition: HydjetWrapper.h:66
void * calloc(size_t nitems, size_t item_size) noexcept

◆ free()

void free ( void *  ptr)
noexcept

Definition at line 212 of file memory_proxies.cc.

References CMS_SA_ALLOW, cms::perftools::AllocMonitorRegistry::instance(), and definitions::original.

Referenced by evf::__attribute__(), cond::auth::Cipher::b64decrypt(), cond::auth::Cipher::b64encrypt(), base64_decode_alloc_ctx(), RivetAnalyzer::beginJob(), DQMEventInfo::bookHistograms(), pat::UserData::checkDictionaries(), lumi::Lumi2DB::cleanTemporaryMemory(), pat::EventHypothesis::createExceptionMessage(), aligned_allocator< T, Alignment >::deallocate(), cond::auth::Cipher::decrypt(), mkfit::Pool< mkfit::MkFitter >::destroy(), notcub::CachingDeviceAllocator::DeviceAllocate(), notcub::CachingDeviceAllocator::DeviceFree(), DQMHarvestingMetadata::dqmEndRun(), ExternalLHEProducer::executeScript(), LumiProducer::fillLSCache(), SiStripHistoPlotter::fillNamedImageBuffer(), edm::storage::LocalFileSystem::findCachePath(), edm::storage::LocalFileSystem::findMount(), cond::auth::DecodingKey::flush(), notcub::CachingDeviceAllocator::FreeAllCached(), getCompressedBuffer(), WatcherStreamFileReader::getInputFile(), l1t::Parameter::getVector(), cond::auth::DecodingKey::init(), edm::storage::LocalFileSystem::initFSList(), EGammaMvaEleEstimatorCSA14::initialize(), EGammaMvaEleEstimator::initialize(), edm::storage::LocalFileSystem::isLocalPath(), reco::details::loadTMVAWeights(), edm::storage::RemoteFile::local(), main(), MyFree(), cms::cuda::host::impl::HostDeleter::operator()(), operator*(), dqm::implementation::DQMStore::printTrace(), edm::storage::LocalFileSystem::readFSTypes(), reco::details::readGzipFile(), readRemote(), cms::h5::Attribute::readString(), EcalLaserCondTools::FileReader::readTime(), lumi::Lumi2DB::retrieveData(), edm::typeDemangle(), lumi::Lumi2DB::writeBeamIntensityOnly(), LMFDat::writeDB(), Json::BatchAllocator< AllocatedType, objectPerAllocation >::~BatchAllocator(), Demangle::~Demangle(), DTSpy::~DTSpy(), edm::storage::LocalFileSystem::~LocalFileSystem(), Matriplex::MatriplexVector< MP >::~MatriplexVector(), and edm::service::SimpleMemoryCheck::~SimpleMemoryCheck().

212  {
213  CMS_SA_ALLOW static const auto original = get<decltype(&::free)>("free");
214  // ignore memory allocated from our static array at startup
215  if (not is_local_alloc(ptr)) {
216  if (not alloc_monitor_running_state()) {
217  original(ptr);
218  return;
219  }
220 
221  auto& reg = AllocMonitorRegistry::instance();
222  reg.deallocCalled(
223  ptr, [](auto ptr) { original(ptr); }, [](auto ptr) { return malloc_usable_size(ptr); });
224  }
225 }
#define CMS_SA_ALLOW
static PFTauRenderPlugin instance

◆ malloc()

void* malloc ( size_t  size)
noexcept

Definition at line 96 of file memory_proxies.cc.

References init, cms::perftools::AllocMonitorRegistry::instance(), definitions::original, and runTheMatrix::ret.

Referenced by evf::__attribute__(), Json::BatchAllocator< AllocatedType, objectPerAllocation >::allocateBatch(), base64_decode_alloc_ctx(), base64_encode_alloc(), cond::auth::Cipher::bf_process_alloc(), cree_mat(), cree_mat_prod(), DTSpy::DTSpy(), LumiProducer::fillLSCache(), getCompressedBuffer(), cond::auth::DecodingKey::init(), edm::storage::LocalFileSystem::initFSInfo(), EGammaMvaEleEstimatorCSA14::initialize(), EGammaMvaEleEstimator::initialize(), edm::storage::RemoteFile::local(), MyAlloc(), reco::details::readGzipFile(), lumi::Lumi2DB::retrieveBeamIntensity(), lumi::Lumi2DB::retrieveData(), and LMFDat::writeDB().

96  {
97  const auto original = Originals::malloc;
99  if (not alloc_monitor_running_state()) {
100  return original(size);
101  }
102  auto& reg = AllocMonitorRegistry::instance();
103  return reg.allocCalled(
104  size, [size, original]() { return original(size); }, [](auto ret) { return malloc_usable_size(ret); });
105 }
size
Write out results.
static PFTauRenderPlugin instance
ret
prodAgent to be discontinued
int init
Definition: HydjetWrapper.h:66
void * malloc(size_t size) noexcept

◆ memalign()

void* memalign ( size_t  alignment,
size_t  size 
)
noexcept

Definition at line 199 of file memory_proxies.cc.

References myMessageLogger_cff::alignment, CMS_SA_ALLOW, cms::perftools::AllocMonitorRegistry::instance(), definitions::original, and runTheMatrix::ret.

199  {
200  CMS_SA_ALLOW static const auto original = get<decltype(&::memalign)>("memalign");
201  if (not alloc_monitor_running_state()) {
202  return original(alignment, size);
203  }
204 
205  auto& reg = AllocMonitorRegistry::instance();
206  return reg.allocCalled(
207  size,
208  [alignment, size]() { return original(alignment, size); },
209  [](auto ret) { return malloc_usable_size(ret); });
210 }
size
Write out results.
#define CMS_SA_ALLOW
static PFTauRenderPlugin instance
ret
prodAgent to be discontinued

◆ operator delete() [1/6]

void operator delete ( void *  ptr)
noexcept

Definition at line 247 of file memory_proxies.cc.

References CMS_SA_ALLOW, cms::perftools::AllocMonitorRegistry::instance(), and definitions::original.

247  {
248  CMS_SA_ALLOW static const auto original = get<void (*)(void*)>("_ZdlPv");
249  if (not alloc_monitor_running_state()) {
250  original(ptr);
251  return;
252  }
253 
254  auto& reg = AllocMonitorRegistry::instance();
255  reg.deallocCalled(
256  ptr, [](auto ptr) { original(ptr); }, [](auto ptr) { return malloc_usable_size(ptr); });
257 } //_ZdlPv
#define CMS_SA_ALLOW
static PFTauRenderPlugin instance

◆ operator delete() [2/6]

void operator delete ( void *  ptr,
std::align_val_t  al 
)
noexcept

Definition at line 359 of file memory_proxies.cc.

References CMS_SA_ALLOW, cms::perftools::AllocMonitorRegistry::instance(), and definitions::original.

359  {
360  CMS_SA_ALLOW static const auto original = get<void (*)(void*, std::align_val_t) noexcept>("_ZdlPvSt11align_val_t");
361 
362  if (not alloc_monitor_running_state()) {
363  original(ptr, al);
364  return;
365  }
366  auto& reg = AllocMonitorRegistry::instance();
367  reg.deallocCalled(
368  ptr, [al](auto ptr) { original(ptr, al); }, [](auto ptr) { return malloc_usable_size(ptr); });
369 } //_ZdlPvSt11align_val_t
#define CMS_SA_ALLOW
static PFTauRenderPlugin instance

◆ operator delete() [3/6]

void operator delete ( void *  ptr,
std::size_t  sz 
)
noexcept

Definition at line 383 of file memory_proxies.cc.

References CMS_SA_ALLOW, cms::perftools::AllocMonitorRegistry::instance(), and definitions::original.

383  {
384  CMS_SA_ALLOW static const auto original = get<void (*)(void*, std::size_t) noexcept>("_ZdlPvm");
385 
386  if (not alloc_monitor_running_state()) {
387  original(ptr, sz);
388  return;
389  }
390  auto& reg = AllocMonitorRegistry::instance();
391  reg.deallocCalled(
392  ptr, [sz](auto ptr) { original(ptr, sz); }, [](auto ptr) { return malloc_usable_size(ptr); });
393 } //_ZdlPvm
#define CMS_SA_ALLOW
static PFTauRenderPlugin instance

◆ operator delete() [4/6]

void operator delete ( void *  ptr,
std::size_t  sz,
std::align_val_t  al 
)
noexcept

Definition at line 407 of file memory_proxies.cc.

References CMS_SA_ALLOW, cms::perftools::AllocMonitorRegistry::instance(), and definitions::original.

407  {
408  CMS_SA_ALLOW static const auto original =
409  get<void (*)(void*, std::size_t, std::align_val_t) noexcept>("_ZdlPvmSt11align_val_t");
410 
411  if (not alloc_monitor_running_state()) {
412  original(ptr, sz, al);
413  return;
414  }
415  auto& reg = AllocMonitorRegistry::instance();
416  reg.deallocCalled(
417  ptr, [sz, al](auto ptr) { original(ptr, sz, al); }, [](auto ptr) { return malloc_usable_size(ptr); });
418 } //_ZdlPvmSt11align_val_t
#define CMS_SA_ALLOW
static PFTauRenderPlugin instance

◆ operator delete() [5/6]

void operator delete ( void *  ptr,
const std::nothrow_t &  tag 
)
noexcept

Definition at line 433 of file memory_proxies.cc.

References CMS_SA_ALLOW, cms::perftools::AllocMonitorRegistry::instance(), definitions::original, and makeGlobalPositionRcd_cfg::tag.

433  {
434  CMS_SA_ALLOW static const auto original =
435  get<void (*)(void*, const std::nothrow_t&) noexcept>("_ZdlPvRKSt9nothrow_t");
436 
437  if (not alloc_monitor_running_state()) {
438  original(ptr, tag);
439  return;
440  }
441  auto& reg = AllocMonitorRegistry::instance();
442  reg.deallocCalled(
443  ptr, [&tag](auto ptr) { original(ptr, tag); }, [](auto ptr) { return malloc_usable_size(ptr); });
444 } //_ZdlPvRKSt9nothrow_t
#define CMS_SA_ALLOW
static PFTauRenderPlugin instance

◆ operator delete() [6/6]

void operator delete ( void *  ptr,
std::align_val_t  al,
const std::nothrow_t &  tag 
)
noexcept

Definition at line 459 of file memory_proxies.cc.

References CMS_SA_ALLOW, cms::perftools::AllocMonitorRegistry::instance(), definitions::original, and makeGlobalPositionRcd_cfg::tag.

459  {
460  CMS_SA_ALLOW static const auto original =
461  get<void (*)(void*, std::align_val_t, const std::nothrow_t&) noexcept>("_ZdlPvSt11align_val_tRKSt9nothrow_t");
462 
463  if (not alloc_monitor_running_state()) {
464  original(ptr, al, tag);
465  return;
466  }
467  auto& reg = AllocMonitorRegistry::instance();
468  reg.deallocCalled(
469  ptr, [al, &tag](auto ptr) { original(ptr, al, tag); }, [](auto ptr) { return malloc_usable_size(ptr); });
470 } //_ZdlPvSt11align_val_tRKSt9nothrow_t
#define CMS_SA_ALLOW
static PFTauRenderPlugin instance

◆ operator delete[]() [1/6]

void operator delete[] ( void *  ptr)
noexcept

Definition at line 270 of file memory_proxies.cc.

References CMS_SA_ALLOW, cms::perftools::AllocMonitorRegistry::instance(), and definitions::original.

270  {
271  CMS_SA_ALLOW static const auto original = get<void (*)(void*)>("_ZdaPv");
272 
273  if (not alloc_monitor_running_state()) {
274  original(ptr);
275  return;
276  }
277  auto& reg = AllocMonitorRegistry::instance();
278  reg.deallocCalled(
279  ptr, [](auto ptr) { original(ptr); }, [](auto ptr) { return malloc_usable_size(ptr); });
280 } //_ZdaPv
#define CMS_SA_ALLOW
static PFTauRenderPlugin instance

◆ operator delete[]() [2/6]

void operator delete[] ( void *  ptr,
std::align_val_t  al 
)
noexcept

Definition at line 371 of file memory_proxies.cc.

References CMS_SA_ALLOW, cms::perftools::AllocMonitorRegistry::instance(), and definitions::original.

371  {
372  CMS_SA_ALLOW static const auto original = get<void (*)(void*, std::align_val_t) noexcept>("_ZdaPvSt11align_val_t");
373 
374  if (not alloc_monitor_running_state()) {
375  original(ptr, al);
376  return;
377  }
378  auto& reg = AllocMonitorRegistry::instance();
379  reg.deallocCalled(
380  ptr, [al](auto ptr) { original(ptr, al); }, [](auto ptr) { return malloc_usable_size(ptr); });
381 } //_ZdaPvSt11align_val_t
#define CMS_SA_ALLOW
static PFTauRenderPlugin instance

◆ operator delete[]() [3/6]

void operator delete[] ( void *  ptr,
std::size_t  sz 
)
noexcept

Definition at line 395 of file memory_proxies.cc.

References CMS_SA_ALLOW, cms::perftools::AllocMonitorRegistry::instance(), and definitions::original.

395  {
396  CMS_SA_ALLOW static const auto original = get<void (*)(void*, std::size_t) noexcept>("_ZdaPvm");
397 
398  if (not alloc_monitor_running_state()) {
399  original(ptr, sz);
400  return;
401  }
402  auto& reg = AllocMonitorRegistry::instance();
403  reg.deallocCalled(
404  ptr, [sz](auto ptr) { original(ptr, sz); }, [](auto ptr) { return malloc_usable_size(ptr); });
405 } //_ZdaPvm
#define CMS_SA_ALLOW
static PFTauRenderPlugin instance

◆ operator delete[]() [4/6]

void operator delete[] ( void *  ptr,
std::size_t  sz,
std::align_val_t  al 
)
noexcept

Definition at line 420 of file memory_proxies.cc.

References CMS_SA_ALLOW, cms::perftools::AllocMonitorRegistry::instance(), and definitions::original.

420  {
421  CMS_SA_ALLOW static const auto original =
422  get<void (*)(void*, std::size_t, std::align_val_t) noexcept>("_ZdaPvmSt11align_val_t");
423 
424  if (not alloc_monitor_running_state()) {
425  original(ptr, sz, al);
426  return;
427  }
428  auto& reg = AllocMonitorRegistry::instance();
429  reg.deallocCalled(
430  ptr, [sz, al](auto ptr) { original(ptr, sz, al); }, [](auto ptr) { return malloc_usable_size(ptr); });
431 } //_ZdaPvmSt11align_val_t
#define CMS_SA_ALLOW
static PFTauRenderPlugin instance

◆ operator delete[]() [5/6]

void operator delete[] ( void *  ptr,
const std::nothrow_t &  tag 
)
noexcept

Definition at line 446 of file memory_proxies.cc.

References CMS_SA_ALLOW, cms::perftools::AllocMonitorRegistry::instance(), definitions::original, and makeGlobalPositionRcd_cfg::tag.

446  {
447  CMS_SA_ALLOW static const auto original =
448  get<void (*)(void*, const std::nothrow_t&) noexcept>("_ZdaPvRKSt9nothrow_t");
449 
450  if (not alloc_monitor_running_state()) {
451  original(ptr, tag);
452  return;
453  }
454  auto& reg = AllocMonitorRegistry::instance();
455  reg.deallocCalled(
456  ptr, [&tag](auto ptr) { original(ptr, tag); }, [](auto ptr) { return malloc_usable_size(ptr); });
457 } //_ZdaPvRKSt9nothrow_t
#define CMS_SA_ALLOW
static PFTauRenderPlugin instance

◆ operator delete[]() [6/6]

void operator delete[] ( void *  ptr,
std::align_val_t  al,
const std::nothrow_t &  tag 
)
noexcept

Definition at line 472 of file memory_proxies.cc.

References CMS_SA_ALLOW, cms::perftools::AllocMonitorRegistry::instance(), definitions::original, and makeGlobalPositionRcd_cfg::tag.

472  {
473  CMS_SA_ALLOW static const auto original =
474  get<void (*)(void*, std::align_val_t, const std::nothrow_t&) noexcept>("_ZdaPvSt11align_val_tRKSt9nothrow_t");
475 
476  if (not alloc_monitor_running_state()) {
477  original(ptr, al, tag);
478  return;
479  }
480  auto& reg = AllocMonitorRegistry::instance();
481  reg.deallocCalled(
482  ptr, [al, &tag](auto ptr) { original(ptr, al, tag); }, [](auto ptr) { return malloc_usable_size(ptr); });
483 } //_ZdaPvSt11align_val_tRKSt9nothrow_t
#define CMS_SA_ALLOW
static PFTauRenderPlugin instance

◆ operator new() [1/4]

void* operator new ( std::size_t  size)

Definition at line 236 of file memory_proxies.cc.

References CMS_SA_ALLOW, cms::perftools::AllocMonitorRegistry::instance(), definitions::original, and runTheMatrix::ret.

236  {
237  CMS_SA_ALLOW static const auto original = get<void* (*)(std::size_t)>("_Znwm");
238  if (not alloc_monitor_running_state()) {
239  return original(size);
240  }
241 
242  auto& reg = AllocMonitorRegistry::instance();
243  return reg.allocCalled(
244  size, [size]() { return original(size); }, [](auto ret) { return malloc_usable_size(ret); });
245 } //_Znwm
size
Write out results.
#define CMS_SA_ALLOW
static PFTauRenderPlugin instance
ret
prodAgent to be discontinued

◆ operator new() [2/4]

void* operator new ( std::size_t  size,
std::align_val_t  al 
)

Definition at line 282 of file memory_proxies.cc.

References CMS_SA_ALLOW, cms::perftools::AllocMonitorRegistry::instance(), definitions::original, and runTheMatrix::ret.

282  {
283  CMS_SA_ALLOW static const auto original = get<void* (*)(std::size_t, std::align_val_t)>("_ZnwmSt11align_val_t");
284  if (not alloc_monitor_running_state()) {
285  return original(size, al);
286  }
287 
288  auto& reg = AllocMonitorRegistry::instance();
289  return reg.allocCalled(
290  size, [size, al]() { return original(size, al); }, [](auto ret) { return malloc_usable_size(ret); });
291 } //_ZnwmSt11align_val_t
size
Write out results.
#define CMS_SA_ALLOW
static PFTauRenderPlugin instance
ret
prodAgent to be discontinued

◆ operator new() [3/4]

void* operator new ( std::size_t  size,
const std::nothrow_t &  tag 
)
noexcept

Definition at line 305 of file memory_proxies.cc.

References CMS_SA_ALLOW, cms::perftools::AllocMonitorRegistry::instance(), definitions::original, runTheMatrix::ret, and makeGlobalPositionRcd_cfg::tag.

305  {
306  CMS_SA_ALLOW static const auto original =
307  get<void* (*)(std::size_t, const std::nothrow_t&) noexcept>("_ZnwmRKSt9nothrow_t");
308 
309  if (not alloc_monitor_running_state()) {
310  return original(size, tag);
311  }
312 
313  auto& reg = AllocMonitorRegistry::instance();
314  return reg.allocCalled(
315  size, [size, &tag]() { return original(size, tag); }, [](auto ret) { return malloc_usable_size(ret); });
316 } //_ZnwmRKSt9nothrow_t
size
Write out results.
#define CMS_SA_ALLOW
static PFTauRenderPlugin instance
ret
prodAgent to be discontinued

◆ operator new() [4/4]

void* operator new ( std::size_t  size,
std::align_val_t  al,
const std::nothrow_t &  tag 
)
noexcept

Definition at line 331 of file memory_proxies.cc.

References CMS_SA_ALLOW, cms::perftools::AllocMonitorRegistry::instance(), definitions::original, runTheMatrix::ret, and makeGlobalPositionRcd_cfg::tag.

331  {
332  CMS_SA_ALLOW static const auto original =
333  get<void* (*)(std::size_t, std::align_val_t, const std::nothrow_t&) noexcept>(
334  "_ZnwmSt11align_val_tRKSt9nothrow_t");
335 
336  if (not alloc_monitor_running_state()) {
337  return original(size, al, tag);
338  }
339 
340  auto& reg = AllocMonitorRegistry::instance();
341  return reg.allocCalled(
342  size, [size, al, &tag]() { return original(size, al, tag); }, [](auto ret) { return malloc_usable_size(ret); });
343 } //_ZnwmSt11align_val_tRKSt9nothrow_t
size
Write out results.
#define CMS_SA_ALLOW
static PFTauRenderPlugin instance
ret
prodAgent to be discontinued

◆ operator new[]() [1/4]

void* operator new[] ( std::size_t  size)

Definition at line 259 of file memory_proxies.cc.

References CMS_SA_ALLOW, cms::perftools::AllocMonitorRegistry::instance(), definitions::original, and runTheMatrix::ret.

259  {
260  CMS_SA_ALLOW static const auto original = get<void* (*)(std::size_t)>("_Znam");
261  if (not alloc_monitor_running_state()) {
262  return original(size);
263  }
264 
265  auto& reg = AllocMonitorRegistry::instance();
266  return reg.allocCalled(
267  size, [size]() { return original(size); }, [](auto ret) { return malloc_usable_size(ret); });
268 } //_Znam
size
Write out results.
#define CMS_SA_ALLOW
static PFTauRenderPlugin instance
ret
prodAgent to be discontinued

◆ operator new[]() [2/4]

void* operator new[] ( std::size_t  size,
std::align_val_t  al 
)

Definition at line 293 of file memory_proxies.cc.

References CMS_SA_ALLOW, cms::perftools::AllocMonitorRegistry::instance(), definitions::original, and runTheMatrix::ret.

293  {
294  CMS_SA_ALLOW static const auto original = get<void* (*)(std::size_t, std::align_val_t)>("_ZnamSt11align_val_t");
295 
296  if (not alloc_monitor_running_state()) {
297  return original(size, al);
298  }
299 
300  auto& reg = AllocMonitorRegistry::instance();
301  return reg.allocCalled(
302  size, [size, al]() { return original(size, al); }, [](auto ret) { return malloc_usable_size(ret); });
303 } //_ZnamSt11align_val_t
size
Write out results.
#define CMS_SA_ALLOW
static PFTauRenderPlugin instance
ret
prodAgent to be discontinued

◆ operator new[]() [3/4]

void* operator new[] ( std::size_t  size,
const std::nothrow_t &  tag 
)
noexcept

Definition at line 318 of file memory_proxies.cc.

References CMS_SA_ALLOW, cms::perftools::AllocMonitorRegistry::instance(), definitions::original, runTheMatrix::ret, and makeGlobalPositionRcd_cfg::tag.

318  {
319  CMS_SA_ALLOW static const auto original =
320  get<void* (*)(std::size_t, const std::nothrow_t&) noexcept>("_ZnamRKSt9nothrow_t");
321 
322  if (not alloc_monitor_running_state()) {
323  return original(size, tag);
324  }
325 
326  auto& reg = AllocMonitorRegistry::instance();
327  return reg.allocCalled(
328  size, [size, &tag]() { return original(size, tag); }, [](auto ret) { return malloc_usable_size(ret); });
329 } //_ZnamRKSt9nothrow_t
size
Write out results.
#define CMS_SA_ALLOW
static PFTauRenderPlugin instance
ret
prodAgent to be discontinued

◆ operator new[]() [4/4]

void* operator new[] ( std::size_t  size,
std::align_val_t  al,
const std::nothrow_t &  tag 
)
noexcept

Definition at line 345 of file memory_proxies.cc.

References CMS_SA_ALLOW, cms::perftools::AllocMonitorRegistry::instance(), definitions::original, runTheMatrix::ret, and makeGlobalPositionRcd_cfg::tag.

345  {
346  CMS_SA_ALLOW static const auto original =
347  get<void* (*)(std::size_t, std::align_val_t, const std::nothrow_t&) noexcept>(
348  "_ZnamSt11align_val_tRKSt9nothrow_t");
349 
350  if (not alloc_monitor_running_state()) {
351  return original(size, al, tag);
352  }
353 
354  auto& reg = AllocMonitorRegistry::instance();
355  return reg.allocCalled(
356  size, [size, al, &tag]() { return original(size, al, tag); }, [](auto ret) { return malloc_usable_size(ret); });
357 } //_ZnamSt11align_val_tRKSt9nothrow_t
size
Write out results.
#define CMS_SA_ALLOW
static PFTauRenderPlugin instance
ret
prodAgent to be discontinued

◆ posix_memalign()

int posix_memalign ( void **  memptr,
size_t  alignment,
size_t  size 
)
noexcept

Definition at line 180 of file memory_proxies.cc.

References myMessageLogger_cff::alignment, CMS_SA_ALLOW, cms::perftools::AllocMonitorRegistry::instance(), definitions::original, and runTheMatrix::ret.

180  {
181  CMS_SA_ALLOW static const auto original = get<decltype(&::posix_memalign)>("posix_memalign");
182  if (not alloc_monitor_running_state()) {
183  return original(memptr, alignment, size);
184  }
185 
186  auto& reg = AllocMonitorRegistry::instance();
187  int ret;
188  reg.allocCalled(
189  size,
190  [&ret, memptr, alignment, size]() {
191  ret = original(memptr, alignment, size);
192  return *memptr;
193  },
194  [](auto ret) { return malloc_usable_size(ret); });
195  return ret;
196 }
size
Write out results.
#define CMS_SA_ALLOW
static PFTauRenderPlugin instance
ret
prodAgent to be discontinued

◆ realloc()

void* realloc ( void *  ptr,
size_t  size 
)
noexcept

Definition at line 143 of file memory_proxies.cc.

References CMS_SA_ALLOW, g, cms::perftools::AllocMonitorRegistry::instance(), definitions::original, and runTheMatrix::ret.

Referenced by fgettoken().

143  {
144  CMS_SA_ALLOW static const auto original = get<decltype(&::realloc)>("realloc");
145  if (not alloc_monitor_running_state()) {
146  return original(ptr, size);
147  }
148  size_t oldsize = malloc_usable_size(ptr);
149  void* ret;
150  auto& reg = AllocMonitorRegistry::instance();
151  {
152  //incase this calls malloc/free
153  [[maybe_unused]] auto g = reg.makeGuard();
154  ret = original(ptr, size);
155  }
156  size_t used = malloc_usable_size(ret);
157  if (used != oldsize) {
158  reg.deallocCalled(
159  ptr, [](auto) {}, [oldsize](auto) { return oldsize; });
160  reg.allocCalled(
161  size, []() { return nullptr; }, [used](auto) { return used; });
162  }
163  return ret;
164 }
size
Write out results.
#define CMS_SA_ALLOW
static PFTauRenderPlugin instance
ret
prodAgent to be discontinued
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e g
Definition: Activities.doc:4