コード例 #1
0
        /// <summary> Processes realloc operation for this callstack and updates lifecycles if needed. </summary>
        public FAllocationLifecycle ProcessRealloc(FStreamToken StreamToken, ref FAllocationLifecycle NewLifecycle, FCallStack PreviousCallStack, FAllocationLifecycle PreviousLifecycle)
        {
            FAllocationLifecycle Result = null;
            int  SizeChange             = 0;
            bool bFreshRealloc          = true;

            FAllocationLifecycle Lifecycle;

            if (IncompleteLifecycles.TryGetValue(StreamToken.OldPointer, out Lifecycle))
            {
                IncompleteLifecycles.Remove(StreamToken.OldPointer);
                Lifecycle.Realloc(StreamToken, this, out SizeChange);
                if (Lifecycle.bIsComplete)
                {
                    if (FStreamInfo.GlobalInstance.CreationOptions.KeepLifecyclesCheckBox.Checked)
                    {
                        CompleteLifecycles.Add(Lifecycle);
                    }
                }
                else
                {
                    IncompleteLifecycles.Add(Lifecycle.LatestPointer, Lifecycle);
                }

                bFreshRealloc = false;
                Result        = Lifecycle;
            }
            else
            {
                Debug.Assert(NewLifecycle != null);
                NewLifecycle.Malloc(StreamToken, PreviousCallStack, PreviousLifecycle);
                Result       = NewLifecycle;
                NewLifecycle = null;

                IncompleteLifecycles.Add(Result.LatestPointer, Result);

                bFreshRealloc = true;
                SizeChange    = StreamToken.Size;
            }

            LatestSize += SizeChange;
            if (LatestSize > MaxSize)
            {
                MaxSize = LatestSize;
            }

            // it's possible that this point was already added to the graph via realloc chain propagation
            if (SizeGraphPoints != null && (SizeGraphPoints.Count == 0 || SizeGraphPoints[SizeGraphPoints.Count - 1].StreamIndex != StreamToken.StreamIndex))
            {
                SizeGraphPoints.Add(new FSizeGraphPoint(StreamToken.StreamIndex, SizeChange, bFreshRealloc));
            }

            return(Result);
        }
コード例 #2
0
        /// <summary> Processes malloc operation for this callstack and updates lifecycles if needed. </summary>
        public void ProcessMalloc(FStreamToken StreamToken, ref FAllocationLifecycle NewLifecycle)
        {
            // Initialize a new lifecycle and add it to the array of incomplete lifecycles.
            NewLifecycle.Malloc(StreamToken, null, null);
            IncompleteLifecycles.Add(NewLifecycle.LatestPointer, NewLifecycle);
            NewLifecycle = null;

            LatestSize += StreamToken.Size;
            if (LatestSize > MaxSize)
            {
                MaxSize = LatestSize;
            }

            if (SizeGraphPoints != null)
            {
                Debug.Assert(SizeGraphPoints.Count == 0 || SizeGraphPoints[SizeGraphPoints.Count - 1].StreamIndex != StreamToken.StreamIndex);
                SizeGraphPoints.Add(new FSizeGraphPoint(StreamToken.StreamIndex, StreamToken.Size, false));
            }
        }
コード例 #3
0
ファイル: CallStack.cs プロジェクト: xiangyuan/Unreal4
		/// <summary> Processes realloc operation for this callstack and updates lifecycles if needed. </summary>
		public FAllocationLifecycle ProcessRealloc(FStreamToken StreamToken, ref FAllocationLifecycle NewLifecycle, FCallStack PreviousCallStack, FAllocationLifecycle PreviousLifecycle)
		{
			FAllocationLifecycle Result = null;
			int SizeChange = 0;
			bool bFreshRealloc = true;

			FAllocationLifecycle Lifecycle;
			if (IncompleteLifecycles.TryGetValue(StreamToken.OldPointer, out Lifecycle))
			{
				IncompleteLifecycles.Remove(StreamToken.OldPointer);
				Lifecycle.Realloc(StreamToken, this, out SizeChange);
				if (Lifecycle.bIsComplete)
				{
					if (FStreamInfo.GlobalInstance.CreationOptions.KeepLifecyclesCheckBox.Checked)
					{
						CompleteLifecycles.Add(Lifecycle);
					}
				}
				else
				{
					IncompleteLifecycles.Add(Lifecycle.LatestPointer, Lifecycle);
				}

				bFreshRealloc = false;
				Result = Lifecycle;
			}
			else
			{
				Debug.Assert(NewLifecycle != null);
				NewLifecycle.Malloc(StreamToken, PreviousCallStack, PreviousLifecycle);
				Result = NewLifecycle;
				NewLifecycle = null;

				IncompleteLifecycles.Add(Result.LatestPointer, Result);

				bFreshRealloc = true;
				SizeChange = StreamToken.Size;
			}

			LatestSize += SizeChange;
			if (LatestSize > MaxSize)
			{
				MaxSize = LatestSize;
			}

			// it's possible that this point was already added to the graph via realloc chain propagation
			if (SizeGraphPoints != null && (SizeGraphPoints.Count == 0 || SizeGraphPoints[SizeGraphPoints.Count - 1].StreamIndex != StreamToken.StreamIndex))
			{
				SizeGraphPoints.Add(new FSizeGraphPoint(StreamToken.StreamIndex, SizeChange, bFreshRealloc));
			}

			return Result;
		}
コード例 #4
0
ファイル: CallStack.cs プロジェクト: xiangyuan/Unreal4
		/// <summary> Processes malloc operation for this callstack and updates lifecycles if needed. </summary>
		public void ProcessMalloc(FStreamToken StreamToken, ref FAllocationLifecycle NewLifecycle)
		{
			// Initialize a new lifecycle and add it to the array of incomplete lifecycles.
			NewLifecycle.Malloc(StreamToken, null, null);
			IncompleteLifecycles.Add(NewLifecycle.LatestPointer, NewLifecycle);
			NewLifecycle = null;

			LatestSize += StreamToken.Size;
			if (LatestSize > MaxSize)
			{
				MaxSize = LatestSize;
			}

			if (SizeGraphPoints != null)
			{
				Debug.Assert(SizeGraphPoints.Count == 0 || SizeGraphPoints[SizeGraphPoints.Count - 1].StreamIndex != StreamToken.StreamIndex);
				SizeGraphPoints.Add(new FSizeGraphPoint(StreamToken.StreamIndex, StreamToken.Size, false));
			}
		}