Memory leak in XamLibrary class


Given that the XamLibrary class is a singleton it can never be disposed of however it uses the same pattern of storing objects it creates in the factoryObjects list as other XamObject objects do. Whenever the CreateXSystem method is called the newly created XSystem is stored in the factoryObjects member so the object can never be released. Given the whole point of storing objects in the list is to enable them to be disposed of when the parent instance is closed this has no purpose in the XamLibrary class. The method should be changed to the following:
    public XSystem CreateXSystem(string connectionString)
        XSystemHandle xsysh;
        int retval = Imports.XAMLibrary_Connect(connectionString, out xsysh);
        Helpers.CheckAndThrow(retval, "XAMLibrary_Connect");
        XSystem xsys = new XSystem(xsysh);
        return xsys;


gstuartemc wrote Jan 20, 2010 at 9:50 PM

Thanks Sean - good spot! I will rectify this in the next release.

wrote Jan 20, 2010 at 10:13 PM

wrote Jan 22, 2010 at 3:35 PM

wrote Jan 22, 2010 at 3:35 PM

wrote Feb 2, 2013 at 1:32 AM

wrote May 14, 2013 at 9:03 PM

wrote May 14, 2013 at 9:03 PM

wrote Jun 12, 2013 at 1:15 AM