.net - How to disable PLINQ partitioning/batching -


plinq internally batches items takes in order reduce overhead. since items memory intensive i'd minimize buffering exists in plinq query pipeline. how can disable partitioning/batching entirely?

the code looks this:

var myitems = enumerable.range(0, 10000000).select(_ => new byte[1 << 30]); var results =  myitems  .asparallel()  .withmaxdegreeofparallelism(4)  .select(f)  .tolist(); 

in code i'd expect maximum number of (big) items ineligible garbage collection 4.

what want create paritioner on source, specifies nobuffering, , use in plinq query:

var myitems = enumerable.range(0, 1000).select(_ => new byte[1 << 30]); var mypartitioner = partitioner.create(myitems, enumerablepartitioneroptions.nobuffering); var results =     mypartitioner     .asparallel()     .withdegreeofparallelism(4)     .select(f)     .tolist(); 

this query works me, throws outofmemoryexception if skip partitioner (just original query).


Comments

Popular posts from this blog

unity3d - Rotate an object to face an opposite direction -

angular - Is it possible to get native element for formControl? -

javascript - Why jQuery Select box change event is now working? -