ATLAS Offline Software
Loading...
Searching...
No Matches
UnitTestAlg3.cxx
Go to the documentation of this file.
1//
2// Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
3//
4
5// Local include(s).
7
8namespace EL {
9
10 UnitTestAlg3::UnitTestAlg3( const std::string& name, ISvcLocator* svcLoc )
11 : AnaAlgorithm( name, svcLoc ) {
12
13 // Declare the algorithm's properties.
14 declareProperty( "LeakBytes", m_leakBytes = 0,
15 "Number of bytes to leak per event" );
16 }
17
19
20 // Allocate the requested amount of memory.
21 if( m_leakBytes > 0 ) {
22 // This needs to be `volatile` and zeroed out to ensure the memory
23 // really gets allocated by the operating system. Without `volatile`
24 // the compiler is essentially allowed to optimize away the write,
25 // and the operating system isn't required to allocate it if it isn't
26 // written to.
27 volatile char* lostPointer = new volatile char[ m_leakBytes ];
28 for( int i = 0; i < m_leakBytes; ++i ) {
29 *lostPointer = 0;
30 ++lostPointer;
31 }
32 }
33
34 // Return gracefully.
35 return ::StatusCode::SUCCESS;
36 }
37
38} // namespace EL
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
AnaAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
constructor with parameters
virtual::StatusCode execute() override
Function executing the algorithm.
int m_leakBytes
The number of bytes to leak per event.
UnitTestAlg3(const std::string &name, ISvcLocator *svcLoc)
Standard algorithm constructor.
This module defines the arguments passed from the BATCH driver to the BATCH worker.
::StatusCode StatusCode
StatusCode definition for legacy code.