Apparent memory leak in MicroBulletGraph

Micro Charts for WPF Forum

Posted 6 years ago by Rory Plaire
Version: 13.1.0582
Environment: Windows 8 (64-bit)
Avatar

I've been investigating runtime memory profiles in our app, and found an issue which appears come from an Actipro type.

The class `MicroBulletGraph` has a static field of type `MicroChartsLicenseToken`. In the instance constructor of this type, the profiler indicates code similar to the following exists and is run:

 

    if (StaticLicenseTokenField == null)
    {
        StaticLicenseTokenField = new MicroChartsLicenseToken(this);
    }

The problem is the "this" pointer. This roots the instance in a static field and when the control is created and wired up to our viewmodels, eventually a large graph of objects stays rooted from this token referencing the first created `MicroBulletGraph`. We could take pains to sever our links to the control, but it seems that the one instance will stay rooted. I looked to see if any other Actipro control behaves this way, and among the Ribbon and Docking controls I don't see this pattern of a static token instance referencing a control instance.

How can we keep from leaking unused, reachable objects through this `MicroBulletGraph` static field reference?

Comments (4)

Posted 6 years ago by Rory Plaire
Avatar

I've created a workaround which keeps my app running until this matter is addressed. The licensing appears happy, and there is no more leaking of my view models.

 

           
private static readonly FieldInfo _licenseTokenField;
private static Boolean _isLicenseStaticFieldFixed;

static MyMicroBulletGraph()
{
	_licenseTokenField = typeof (MicroBulletGraph).GetField("#vd", BindingFlags.NonPublic | BindingFlags.Static);

	if (_licenseTokenField == null)
	{
		throw new InvalidOperationException("Can't find Actipro MicroBulletGraph license token field");
	}
}

public MyMicroBulletGraph()
{
	if (!_isLicenseStaticFieldFixed)
	{
		var singletonGraph = new MicroBulletGraph();
		var token = new MicroChartsLicenseToken(singletonGraph);
		_licenseTokenField.SetValue(null, token);
		_isLicenseStaticFieldFixed = true;
	}
}
Answer - Posted 6 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Rory,

Thanks for reporting this.  We've fixed it for the next version.


Actipro Software Support

Posted 6 years ago by Rory Plaire
Avatar

Thanks!

Build 0583?

Posted 6 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Yes, or the 2013.2 version.  Whichever comes first.


Actipro Software Support

The latest build of this product (v2018.1 build 0675) was released 12 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.