I made a standalone program that collect all of DBelement from a project
code is work well, but it can't release memories and is killed from windows
Code is Below, i copied parts of them
Do you have any ides or ways to release memories.
#1 code
TypeFilter filter = new TypeFilter(DbElementTypeInstance.SITE);
DbElement world = MDB.CurrentMDB.GetFirstWorld(Aveva.Pdms.Database.DbType.Design);
DBElementCollection collection = new DBElementCollection(world, filter);
filter = null;
world = null;
long mem = 0;
DbElement ele = null;
DBElementEnumerator iter = (DBElementEnumerator)collection.GetEnumerator();
while (iter.MoveNext())
{
mem = GC.GetTotalMemory(true);
Console.WriteLine("memory : {0}", mem);
ele = (DbElement)iter.Current;
if (ele != null && ele.IsValid)
{
Get_Element_From_Site(ele, atts, adodb, tablename); [COLOR="#FF0000"] // --> call #2 code [/COLOR]
}
ele = null;
}
Console.WriteLine("GetNameTable was finished");
#2 code
DBElementCollection collection = new DBElementCollection(aSite, filter); [COLOR="#FF0000"] // --> I think this collection variable doesn't release memory [/COLOR]
collection.IncludeRoot = true;
Can you show us the Exception stack trace? This is quite hard to diagnose without having some information about which line (and call path) exactly leads to the OutOfMemoryException.