archive memory Leaks.

archive memory Leaks.

for loop memory increase
Archive data variable free??
If data should be cleaned up if what should I do?
zenonArchiveVariables=null;
GC.Collect();
In this way, right?
mysource code.

//int yearto = Convert.ToInt32( this.Variables().Item("ExecuteTrend").get_Value(0).ToString());

// if (o is int)

string yearto = this.Variables().Item("Report_year").get_Value(0).ToString();
string monthto = this.Variables().Item("Report_month").get_Value(0).ToString();
string dayo = this.Variables().Item("Report_day").get_Value(0).ToString();


IArchive zenonArchive = this.Archives().Item(0);
System.Diagnostics.Debug.Print("archive : " + zenonArchive.Name);
if (zenonArchive == null)
{
//There is no archive, the user will be informed...
this.Parent.Parent.DebugPrint("No archive available!", tpDebugPrintStyle.tpErr);
return;
}
IArchiveFilter zenonArchiveFilter = zenonArchive.ArchiveFilters().CreateArchiveFilter();
for (int i = 0; i < zenonArchive.ArchiveVariables().Count; ++i)
{
//Add every archive variable to the archive filter
zenonArchiveFilter.AddArchiveVariable(zenonArchive.ArchiveVariables().Item(i));
}

//Set the StartTime to 14:00 on the 30th of july 2007
zenonArchiveFilter.StartTime = (int)TimeConversion.
SystemToZenOn(new DateTime(Convert.ToInt32(yearto), Convert.ToInt32(monthto), Convert.ToInt32(dayo), 0, 0, 0));

////Set the EndTime to 11:15 on the 31st of july 2007
zenonArchiveFilter.EndTime = (int)TimeConversion.
SystemToZenOn(new DateTime(Convert.ToInt32(yearto), Convert.ToInt32(monthto), Convert.ToInt32(dayo), 23, 59,59));


// zenonArchiveFilter.StatusMask = 0x41000; //Check only I-BIT + HWERT
// zenonArchiveFilter.StatusBit = 0x41000; //Return data if one of those bit is true or both

//Initiate a filter query
IArchiveFilterVariables zenonArchiveVariables = zenonArchiveFilter.Query();

//Get the first available filtered variable
IArchiveFilterVariable zenonArchiveFilterVariable = zenonArchiveFilter.ArchiveFilterVariables().Item(0);
IArchiveFilterVariable zenonArchiveFilterVariable1 = zenonArchiveFilter.ArchiveFilterVariables().Item(1);
IArchiveFilterVariable zenonArchiveFilterVariable2 = zenonArchiveFilter.ArchiveFilterVariables().Item(2);
IArchiveFilterVariable zenonArchiveFilterVariable3 = zenonArchiveFilter.ArchiveFilterVariables().Item(3);
IArchiveFilterVariable zenonArchiveFilterVariable4 = zenonArchiveFilter.ArchiveFilterVariables().Item(4);
IArchiveFilterVariable zenonArchiveFilterVariable5 = zenonArchiveFilter.ArchiveFilterVariables().Item(5);
IArchiveValues f = zenonArchiveFilterVariable.ArchiveValues();
IArchiveValues f1 = zenonArchiveFilterVariable1.ArchiveValues();
IArchiveValues f2= zenonArchiveFilterVariable2.ArchiveValues();
IArchiveValues f3 = zenonArchiveFilterVariable3.ArchiveValues();
IArchiveValues f4 = zenonArchiveFilterVariable4.ArchiveValues();
IArchiveValues f5 = zenonArchiveFilterVariable5.ArchiveValues();
IArchiveValue t1;
//f.Item(0).Value.ToString();
if (zenonArchiveFilterVariable == null)
{
//If there is no variable available, inform the user
this.Parent.Parent.DebugPrint("No filtered archive variable available!", tpDebugPrintStyle.tpNrm);
return;
}
//And if there is, output some details
DateTime dateT;



System.Diagnostics.Debug.Print("Variable : " + zenonArchiveFilterVariable.ArchiveVariable().Name);
System.Diagnostics.Debug.Print("count : " + zenonArchiveFilterVariable.ArchiveValues().Count);
System.Diagnostics.Debug.Print("Calculation : " + zenonArchiveFilterVariable.ArchiveVariable().Calculation);
System.Diagnostics.Debug.Print("Variable : " + zenonArchiveFilterVariable1.ArchiveVariable().Name);
System.Diagnostics.Debug.Print("count : " + zenonArchiveFilterVariable1.ArchiveValues().Count);
System.Diagnostics.Debug.Print("Calculation : " + zenonArchiveFilterVariable1.ArchiveVariable().Calculation);
System.Diagnostics.Debug.Print("Variable : " + zenonArchiveFilterVariable2.ArchiveVariable().Name);
System.Diagnostics.Debug.Print("count : " + zenonArchiveFilterVariable2.ArchiveValues().Count);
System.Diagnostics.Debug.Print("Calculation : " + zenonArchiveFilterVariable2.ArchiveVariable().Calculation);
System.Diagnostics.Debug.Print("Variable : " + zenonArchiveFilterVariable3.ArchiveVariable().Name);
System.Diagnostics.Debug.Print("count : " + zenonArchiveFilterVariable3.ArchiveValues().Count);
System.Diagnostics.Debug.Print("Calculation : " + zenonArchiveFilterVariable3.ArchiveVariable().Calculation);
int count = zenonArchiveFilterVariable4.ArchiveValues().Count;
string[,] saNames= new string[15000, 7];
for (int i = 0; i < 15000; ++i)
{
t1 = f.Item(i);
saNames[i, 0] = TimeConversion.ZenOnToSystem((uint)t1.Time).ToString("yyyy-MM-dd HH:mm:ss.fff");
saNames[i, 1] = t1.Value.ToString();
saNames[i, 2] = f1.Item(i).Value.ToString();
saNames[i, 3] = f2.Item(i).Value.ToString();
saNames[i, 4] = f3.Item(i).Value.ToString();
saNames[i, 5] = f4.Item(i).Value.ToString();
saNames[i, 6] = f5.Item(i).Value.ToString();
}
DB_count = zenonArchiveFilterVariable4.ArchiveValues().Count;

This is a migrated post! Originally posted on 30.05.2016 by user backjahyun. Please be aware that information can be outdated.

    Disclaimer

    This document governs the use of our Community Forum. By registering and using the platform, you accept these conditions.

    The COPA-DATA Community Forum serves to encourage the exchange of information and experience about the zenon software between forum users respectively zenon users.

    Please mind that any published information on the Community Forum is the subjective opinion and view based on the experience and the level of knowledge of the author. COPA-DATA does not overtake any responsibility for the content and the accuracy of the shared information.

    Users of the Community Forum are encouraged to share only well-founded experiences and to point out any risks associated with the implementation of proposed solutions to problems. COPA-DATA at its absolute discretion, reserves the right to moderate the forum. In this connection COPA-DATA may remove any information containing false facts, potentially dangerous solutions, bad language or content that may insult, degrade or discriminate others. COPA-DATA may block a non-complying user from forum access if the user violated this provision.

    COPA-DATA reserves the right to change this document from time to time at own discretion.


    Ing. Punzenberger COPA-DATA GmbH
    Karolingerstraße 7b · 5020 Salzburg · Austria
    www.copadata.com