P
Praveen
Hello all,
I am writing a class to cache xml and dataset objects that would be required
frequently by my application. I also have a time to check the last access of
the obect... If the object is not used for some time I would like to remove
it from the cashe to free memmory. I am using hastable to store these
objects.
What I observe is that even if I remove the object from the hastable the
memmory is not freed even if I wait a long time (more than 10 mins) to for
the Garbage collection cycle to happen.
To make sure there was an issue with the garbage collection I wrote a test
application.
I declared a class variable for Hashtable
in one function I am filling the hastable like below
for(int i = 0 ; i < 10000; i++)
{
HTT.Add(Guid.NewGuid().ToString(),new string('d',40000));
}
In another function I am calling HTT.Clear() to delete the items
during this time I am observing the memmory useage in the taskmanager. The
memmory useage rises as expected in the first function call but does not
come down after the second function is called.
I waited enough for the GC cycle more thant 10 mins... after the HTT.Clear
function call if I call CG.Colloect(); then memmory was coming down. I did
not want to do that in my app.
please suggest.
Thanks in advance,
Praveen
I am writing a class to cache xml and dataset objects that would be required
frequently by my application. I also have a time to check the last access of
the obect... If the object is not used for some time I would like to remove
it from the cashe to free memmory. I am using hastable to store these
objects.
What I observe is that even if I remove the object from the hastable the
memmory is not freed even if I wait a long time (more than 10 mins) to for
the Garbage collection cycle to happen.
To make sure there was an issue with the garbage collection I wrote a test
application.
I declared a class variable for Hashtable
in one function I am filling the hastable like below
for(int i = 0 ; i < 10000; i++)
{
HTT.Add(Guid.NewGuid().ToString(),new string('d',40000));
}
In another function I am calling HTT.Clear() to delete the items
during this time I am observing the memmory useage in the taskmanager. The
memmory useage rises as expected in the first function call but does not
come down after the second function is called.
I waited enough for the GC cycle more thant 10 mins... after the HTT.Clear
function call if I call CG.Colloect(); then memmory was coming down. I did
not want to do that in my app.
please suggest.
Thanks in advance,
Praveen