|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Definitions for the class RAnalyzeToolMemoryAllocator. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "analyzetoolmemoryallocator.h" |
|
20 #include "analyzetoolpanics.pan" |
|
21 #include "atlog.h" |
|
22 |
|
23 // ----------------------------------------------------------------------------- |
|
24 // RAnalyzeToolMemoryAllocator::RAnalyzeToolMemoryAllocator() |
|
25 // C++ default constructor. |
|
26 // ----------------------------------------------------------------------------- |
|
27 // |
|
28 RAnalyzeToolMemoryAllocator::RAnalyzeToolMemoryAllocator( TBool aNotFirst ) : |
|
29 RAllocator(), |
|
30 iNotFirst( aNotFirst )/*, |
|
31 iStorageServerOpen( EFalse )*/ |
|
32 { |
|
33 LOGSTR1( "ATMH RAnalyzeToolMemoryAllocator::RAnalyzeToolMemoryAllocator()" ); |
|
34 |
|
35 // Acquire the original allocator |
|
36 iAllocator = &User::Allocator(); |
|
37 |
|
38 // Set memory model zero |
|
39 iMemoryModel = 0; |
|
40 } |
|
41 |
|
42 // ----------------------------------------------------------------------------- |
|
43 // RAnalyzeToolMemoryAllocator::~RAnalyzeToolMemoryAllocator() |
|
44 // Destructor. |
|
45 // ----------------------------------------------------------------------------- |
|
46 // |
|
47 RAnalyzeToolMemoryAllocator::~RAnalyzeToolMemoryAllocator() |
|
48 { |
|
49 LOGSTR1( "ATMH RAnalyzeToolMemoryAllocator::~RAnalyzeToolMemoryAllocator()" ); |
|
50 |
|
51 // Call switching orinigal allocator back. |
|
52 // Just in case, if uninstall was not called. |
|
53 SwitchOriginalAllocator(); |
|
54 } |
|
55 |
|
56 // ----------------------------------------------------------------------------- |
|
57 // RAnalyzeToolMemoryAllocator::SwitchOriginalAllocator() |
|
58 // Switches original allocator in use if not already. |
|
59 // ----------------------------------------------------------------------------- |
|
60 // |
|
61 void RAnalyzeToolMemoryAllocator::SwitchOriginalAllocator() |
|
62 { |
|
63 LOGSTR1( "ATMH RAnalyzeToolMemoryAllocator::SwitchOriginalAllocator()" ); |
|
64 |
|
65 if ( iAllocator != &User::Allocator() ) |
|
66 { |
|
67 User::SwitchAllocator( iAllocator ); |
|
68 } |
|
69 } |
|
70 |
|
71 // End of File |