B
Boris Nienke
Hi,
i'm really new to .NET and i know, that the garbage-collection should free
objects itself... but is there any way to force this?
for example: i have a loop in which i need to create a new object every
time, fill in some data, store it to a database and then... free it...
[pseudo-code]
while (readline(myLine) != eof)
{
TMyObj tempObject = new TMyObj;
tempObject.abc = "abc";
//...more data to fill
StoreObject(tempObject)
//in pascal i would do:
// tempObject.Free;
}
[/pseudo-code]
The loop will run thru about 100000 times - so 100000 objects are created
but only used for a very short time!
I need a new object to have a new reference - so a Clear-Function to clear
my data is not enough.
Question: WHEN will the garbage-collection free the instances of the loops
before?
Boris
i'm really new to .NET and i know, that the garbage-collection should free
objects itself... but is there any way to force this?
for example: i have a loop in which i need to create a new object every
time, fill in some data, store it to a database and then... free it...
[pseudo-code]
while (readline(myLine) != eof)
{
TMyObj tempObject = new TMyObj;
tempObject.abc = "abc";
//...more data to fill
StoreObject(tempObject)
//in pascal i would do:
// tempObject.Free;
}
[/pseudo-code]
The loop will run thru about 100000 times - so 100000 objects are created
but only used for a very short time!
I need a new object to have a new reference - so a Clear-Function to clear
my data is not enough.
Question: WHEN will the garbage-collection free the instances of the loops
before?
Boris