Skip to content
This repository has been archived by the owner on Mar 30, 2019. It is now read-only.

Commit

Permalink
[SharpDX] Change message in ComObject.Dispose for automatic release. …
Browse files Browse the repository at this point in the history
…Remove in case of release on finalizer is enabled.
  • Loading branch information
xoofx committed May 6, 2014
1 parent da71d56 commit eec46c7
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions Source/SharpDX/ComObject.cs
Expand Up @@ -285,12 +285,11 @@ protected unsafe override void Dispose(bool disposing)
// If object is disposed by the finalizer, emits a warning
if(!disposing && Configuration.EnableTrackingReleaseOnFinalizer)
{
var objectReference = ObjectTracker.Find(this);
var additionalMessage = Configuration.EnableReleaseOnFinalizer
? "will be released automatically"
: "memory leak detected";

System.Diagnostics.Debug.WriteLine(string.Format("Warning: Live ComObject, {0}: {1}", additionalMessage, objectReference));
if(!Configuration.EnableReleaseOnFinalizer)
{
var objectReference = ObjectTracker.Find(this);
System.Diagnostics.Debug.WriteLine(string.Format("Warning: Live ComObject [0x{0:X}], potential memory leak: {1}", NativePointer.ToInt64(), objectReference));
}
}

// Release the object
Expand Down

0 comments on commit eec46c7

Please sign in to comment.