|
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: |
|
15 * |
|
16 */ |
|
17 |
|
18 #include "RBuildQueryableHeap.h" |
|
19 |
|
20 // System includes |
|
21 #include <e32std.h> |
|
22 #include <e32debug.h> |
|
23 |
|
24 |
|
25 TBool RBuildQueryableHeap::IsDebugEUser() const |
|
26 { |
|
27 User::__DbgSetAllocFail( FALSE, RAllocator::EFailNext, 1); |
|
28 |
|
29 TInt* cell = new TInt(); |
|
30 #if defined(_DEBUG) && !defined( __WINS__ ) |
|
31 RDebug::Printf("RBuildQueryableHeap::IsDebugEUser() - cell: 0x%08x", cell); |
|
32 #endif |
|
33 |
|
34 const TBool debugEUser = ( cell == NULL ); |
|
35 #if defined(_DEBUG) && !defined( __WINS__ ) |
|
36 RDebug::Printf("RBuildQueryableHeap::IsDebugEUser() - debugEUser: %d", debugEUser); |
|
37 #endif |
|
38 |
|
39 delete cell; |
|
40 // |
|
41 return debugEUser; |
|
42 } |
|
43 |
|
44 |
|
45 TInt RBuildQueryableHeap::CellHeaderSize( TMemSpyDriverCellType aType ) const |
|
46 { |
|
47 TInt size = 0; |
|
48 // |
|
49 switch( aType ) |
|
50 { |
|
51 case EMemSpyDriverGoodAllocatedCell: |
|
52 case EMemSpyDriverBadAllocatedCellSize: |
|
53 case EMemSpyDriverBadAllocatedCellAddress: |
|
54 { |
|
55 size = sizeof( TInt ); // Allocated UREL cells contain just a length |
|
56 if ( IsDebugEUser() ) |
|
57 { |
|
58 size = sizeof( RHeap::SDebugCell ); |
|
59 } |
|
60 break; |
|
61 } |
|
62 case EMemSpyDriverGoodFreeCell: |
|
63 case EMemSpyDriverBadFreeCellAddress: |
|
64 case EMemSpyDriverBadFreeCellSize: |
|
65 size = EFreeCellSize; |
|
66 break; |
|
67 default: |
|
68 break; |
|
69 } |
|
70 // |
|
71 return size; |
|
72 } |
|
73 |