I've a collection with 330000 entities in it.
Sometimes when the server is busy to do several things (= things who are consuming also memory) so that the free memory is limited, my process is eating to much memory when saving, causing a out of memory
this.Context.Adapter.SaveEntityCollection(ec, false, false)
--> They are no related entities, so I did set the boolean recursive already to false.
A solution is to do a foreach loop and to use the SaveEntity method : on memory level, I see it takes about the half of the memory taken by the savecollection, but on time level it is more then doubled...
if (ec.Count <= 200000)
{
return this.Context.Adapter.SaveEntityCollection(ec, false, false); }
else
{
int counter = 0;
foreach (IEntity2 entity in ec)
{
if (this.Context.Adapter.SaveEntity(entity))
counter++;
}
return counter;
}
When the proces is taken out, I receive following error : (it is a printscreen, so I will try to attach it to this topic)
Because of the original design, I can't limit the number of entities in the collection. If I want to do that, I must rewrite completely this module.
So I was thinking about a paging mechanism in the savecollection. That will also consuming memory, but maybe less then now.
Any thoughts?
Attachments
Filename |
File size |
Added on |
Approval |
error_llblgen.JPG
|
38,793 |
30-Sep-2009 17:01.40 |
Approved |