Garbage Collection

When working with the Fore language in Foresight Analytics Platform, garbage collection is implemented that helps delete unused objects and free computer memory. The garbage collector starts automatically at system idle time.

If other development environments are used to work with Fore language resources, the application developer must manage the allocation and release of memory. The following methods of the Prognoz.Platform.Interop.Fore.IForeRuntime interface start the collection process:

The methods starting garbage collection, which is executed in asynchronous mode in another thread, can be used:

These methods should be called within connection to the repository, with which the user is working.

The example of garbage collector start on C#:

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Linq;

using System.Text;

using System.Windows.Forms;

using Prognoz.Platform.Interop.Fore;

using Prognoz.Platform.Interop.Metabase;

namespace TestProject

{

    public partial class Form1 : Prognoz.Platform.Forms.Net.ForeNetFormVS

    {

        public Form1()

        {

            InitializeComponent();

        }

        

        //...

        private void button1_Click(object sender, EventArgs e)

        {

            IForeServices Svc = (IForeServices)this.Metabase;

            IForeRuntime ForeRun = Svc.GetRuntime();

            ForeRun.CollectFullGarbage();

        }

        //...

    }

}

See also:

Using Foresight Analytics Platform Resources in Third-Party Applications