void CMemSpyEngineHelperSysMemTrackerGlobalData::ConstructL( CMemSpyProcess& aProcess, const TMemSpyDriverChunkInfo& aChunkInfo )
    {
    iCurrent = aChunkInfo;
    //
    SetProcess( aProcess.Id() );
    SetHandle( aChunkInfo.iHandle );

    if  ( aChunkInfo.iType == EMemSpyDriverChunkTypeGlobalData )
        {
        // Pure global data, unique chunk
        iLast = new(ELeave) TMemSpyDriverChunkInfo();
        *iLast = aChunkInfo;
        }
    else if ( aChunkInfo.iType == EMemSpyDriverChunkTypeStackAndProcessGlobalData )
        {
        // Mostly stack, possibly some global data too. Get the global data size from
        // the code seg associated with the process.
        CMemSpyEngineCodeSegList* codeSegs = Engine().HelperCodeSegment().CodeSegmentListL( aProcess.Id() );
        CleanupStack::PushL( codeSegs );

        // We're looking for the process codesegment...
        TFileName* fileName = new(ELeave) TFileName();
        CleanupStack::PushL( fileName );
        aProcess.GetFileName( *fileName );
        const TInt pos = codeSegs->IndexByName( *fileName );
        CleanupStack::PopAndDestroy( fileName );

        // Get total data size
        if  ( pos >= 0 )
            {
            const CMemSpyEngineCodeSegEntry& entry = codeSegs->At( pos );
            const TCodeSegCreateInfo& createInfo = entry.CreateInfo();
            iCurrent.iSize = Engine().Driver().RoundToPageSize( createInfo.iTotalDataSize );
            
            // If there is no data, then we don't want an entry in the list, so bail out.
            if  ( iCurrent.iSize == 0 )
                {
                User::Leave( KErrNotSupported );
                }
            }

        CleanupStack::PopAndDestroy( codeSegs );
        }

    iChunkName = aChunkInfo.iName.AllocL();
    }
EXPORT_C void CMemSpyEngineHelperHeap::GetHeapInfoUserL(const CMemSpyProcess& aProcess, 
                                                        RArray<TMemSpyHeapInfo >& aInfos)
    {
    aInfos.Reset();
    iEngine.ProcessSuspendLC( aProcess.Id() );
    //
    TMemSpyHeapInfo info;
    //
    const TInt count = aProcess.Count();
    for( TInt i=0; i<count; i++ )
        {
        const CMemSpyThread& thread = aProcess.At( i );
        //
        GetHeapInfoUserL( aProcess.Id(), thread.Id(), info );
        aInfos.AppendL( info );
        }
    //
    CleanupStack::PopAndDestroy(); // ProcessSuspendLC
    }
EXPORT_C void CMemSpyEngineHelperChunk::OutputChunkInfoForProcessL( const CMemSpyProcess& aProcess )
    {
    OutputChunkInfoForProcessL( aProcess.Id() );
    }