예제 #1
0
        internal override void Process(ProfilerSession sess)
        {
            Tracing.PacketTrace("ALLOC: Object allocated at address {0}", m_address);
            ObjectAllocation alloc = new ObjectAllocation();

            alloc.m_thread  = sess.m_currentThreadPID;
            alloc.m_address = m_address;
            alloc.m_size    = m_size;
            if (!sess.m_threadCallStacks.ContainsKey(sess.m_currentThreadPID))
            {
                sess.m_threadCallStacks.Add(sess.m_currentThreadPID, new Stack <uint>());
            }
            alloc.m_callStack = sess.m_threadCallStacks[sess.m_currentThreadPID].ToArray();
            Array.Reverse(alloc.m_callStack);
            sess.ResolveTypeName(m_type);   //Cache type name.

            if (sess.m_liveObjectTable.BinarySearch(m_address) < 0)
            {
                sess.m_liveObjectTable.Add(m_address);
                sess.m_liveObjectTable.Sort();
            }

            alloc.m_objectType = new ObjectType(m_type, m_rank);
            sess.AddEvent(alloc);
        }
예제 #2
0
        internal override void Process(ProfilerSession sess)
        {
            if (sess.m_currentHeapDump == null)
            {
                //Lost heap-dump start packet, and probably the roots too.
                throw new System.IO.IOException();
            }

            HeapDumpObject hdo = new HeapDumpObject();

            hdo.m_address = m_address;
            hdo.m_size    = m_size;

            if (m_dt == _DBG.RuntimeDataType.DATATYPE_CLASS || m_dt == _DBG.RuntimeDataType.DATATYPE_VALUETYPE)
            {
                sess.ResolveTypeName(m_typedef); //Cache type name.
                hdo.m_type = new ObjectType(m_typedef);
            }
            else
            {
                _DBG.RuntimeDataType dt = (_DBG.RuntimeDataType)m_dt;
                if (dt == _DBG.RuntimeDataType.DATATYPE_SZARRAY)
                {
                    sess.ResolveTypeName(m_arrayElementType); //Cache type name.
                    hdo.m_type = new ObjectType(m_arrayElementType, m_arrayLevels);
                }
                else
                {
                    hdo.m_type = new ObjectType((uint)m_dt);
                }
            }

            hdo.m_references = m_refs;

            Tracing.PacketTrace("object @ {0} ({1})", m_address, hdo.m_type);

            sess.m_currentHeapDump.m_objectTable.Add(hdo);
        }