ATLAS Offline Software
Loading...
Searching...
No Matches
SegMemSvc.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
6
7#include "GaudiKernel/ISvcLocator.h"
8#include "GaudiKernel/IIncidentSvc.h"
9#include "GaudiKernel/Incident.h"
10
11using namespace std;
12
13
14//
16//
17
18SegMemSvc::SegMemSvc( const std::string& name, ISvcLocator* svc )
19 : base_class( name, svc ), p_incSvc("IncidentSvc",name),
20 m_arena_job("sms_job",&m_ahead_job),
21 m_arena_evt("sms_evt",&m_ahead_evt),
22 m_arena_inc("sms_inc",&m_ahead_inc)
23{
24
25}
26
27
28/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
29
33
34
35
36/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
37
38StatusCode
40
44
45 // m_ahead.addArena(&m_arena);
46
47
48 p_incSvc->addListener( this, "EndEvent" );
49 p_incSvc->addListener( this, "DefragMemory" );
50
51 return StatusCode::SUCCESS;
52
53}
54
55/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
56
57void
58SegMemSvc::handle(const Incident& inc) {
59
60 if (inc.type() == "EndEvent") {
61 if (msgStream().level() <= MSG::DEBUG) {
62 std::ostringstream ost;
63 m_ahead_evt.report(ost);
64 debug() << "Running report for " << m_arena_evt.name()
65 << ost.str() << endmsg;
66 }
67
68 debug() << "freeing all memory allocated for Event" << endmsg;
69 m_arena_evt.reset();
70 m_ahead_evt.reset();
71
72 } else if ( inc.type() == "DefragMemory") {
73
74 if (msgStream().level() <= MSG::DEBUG) {
75 debug() << "defragmenting memory" << endmsg;
76 }
77 debug() << "freeing all memory allocated associated with "
78 << "DefragMemory incident" << endmsg;
79 m_arena_inc.reset();
80 m_ahead_inc.reset();
81 }
82
83}
84
#define endmsg
const bool debug
Helper class for making Arena instances current in a stack-like manner.
Definition Arena.h:273
SG::ArenaHeader m_ahead_job
three arenas for different lifetimes
Definition SegMemSvc.h:81
virtual void handle(const Incident &) override
Definition SegMemSvc.cxx:58
SG::ArenaHeader m_ahead_evt
Definition SegMemSvc.h:81
virtual ~SegMemSvc()
Definition SegMemSvc.cxx:30
SG::Arena m_arena_inc
Definition SegMemSvc.h:82
virtual StatusCode initialize() override
Definition SegMemSvc.cxx:39
SG::Arena m_arena_job
Definition SegMemSvc.h:82
SG::Arena m_arena_evt
Definition SegMemSvc.h:82
SegMemSvc(const std::string &name, ISvcLocator *svc)
Definition SegMemSvc.cxx:18
ServiceHandle< IIncidentSvc > p_incSvc
Definition SegMemSvc.h:68
SG::ArenaHeader m_ahead_inc
Definition SegMemSvc.h:81
STL namespace.