Skip to content

ADAPT framework resource issue #292

Open

Description

@martin-datalogisk

I’m new to ADAPT. We are going to use ADAPT to get data from first of all combiners. The data we get as an ISOXML file. Well the ADAPT plugin seems to be the right tool to import to our FMIS GIS application.
So I implemented the ADAPT plug-in to our .NET Webservice via Nuget package (just updated to version 2.20 and ISOplugin 3.2.1)
It seems to work well, I manage to get the data from ISOXML file.
But only for a short time. Every time the plugin is called in the service it builds up resources.
At the end our webservice don’t work properly any more.
Normally the garbage collector will free resources then are not used any more.
But it seems like the plugin holds the data after import.

public class AdaptFramework : IDisposable
{
private DataProvider data = null;

public void Dispose()
{
ApplicationDataModels = null;
data = null;
properties = null;
}

public bool Read_LogData(Map map, int LogDataID)
{
if (ApplicationDataModels != null && ApplicationDataModels.Count > 0)
{
…Code reading the data into our map class
return true;
}
return false;
}

public bool Read_ISOXml(string DataPath)
{
try
{
data = new DataProvider();
AgGateway.ADAPT.ApplicationDataModel.ADM.Properties properties = new AgGateway.ADAPT.ApplicationDataModel.ADM.Properties();
string path = System.Reflection.Assembly.GetExecutingAssembly().CodeBase;
path = path.Substring(8);
path = path.Substring(0, path.LastIndexOf("/", System.StringComparison.Ordinal) + 1);
data.Initialize(path.Replace("/", "\"));
ApplicationDataModels = data.Import(DataPath, string.Empty, properties);
if (ApplicationDataModels == null || ApplicationDataModels.Count == 0)
{
data = null;
ApplicationDataModels = null;
properties = null;
throw new Exception("Not supported data format.");
}
else
return true;
}
catch (Exception ex)
{
ErrorMessage = ex.Message;
data = null;
ApplicationDataModels = null;
properties = null;
return false;
}
}
}

Med venlig hilsen / Best regards

Martin Poulsen
Datalogisk A/S
Stubbekøbingvej 41
DK-4840 Nørre Alslev
Tel: +45 70203311
www.datalogisk.dk
E-mail: martin.poulsen@datalogisk.dk

Activity

  1. kelly-nelson commented on Feb 1, 2021

    @kelly-nelson
    Contributor

    Hi Martin, we recently addressed a resource issue in the latest version of the ISOXML plugin. You can read about it here AgGateway-ADAPT/ISOv4Plugin#125 and here AgGateway-ADAPT/ISOv4Plugin#128. This may help address some of your issues.

    Regarding the framework itself retaining resources, I'm not sure I understand as the consuming code itself controls the scope of the ApplicationDataModels created by the import.

  2. strhea commented on Feb 1, 2021

    @strhea
    Contributor

    You also might find how the code in the visualizer (https://github.com/ADAPT/ADAPT-Visualizer) handles the plugins and data helpful too.

  3. martin-datalogisk commented on Feb 2, 2021

    @martin-datalogisk
    Author

    Hi
    Thanks for your reply.
    I got the lastest version from the nuget manager whice is version 3.2.1. for ISOplugin and 2.2.0 for the Adapt framework, they are only a few days old. I asume that these versions contains fix #128 and #125?
    Yes, I also use the visualizer that's a helpful tool to see that the ISOxml files contains of data.

    Med venlig hilsen / Best regards

    Martin Poulsen
    Datalogisk A/S
    Stubbekøbingvej 41
    DK-4840 Nørre Alslev
    Tel: +45 70203311
    www.datalogisk.dk
    E-mail: martin.poulsen@datalogisk.dk

  4. kelly-nelson commented on Feb 3, 2021

    @kelly-nelson
    Contributor

    Yes, those are the versions. You will just need to set the property I added in the ISO Plugin PR125.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions