1 year ago
#331215
refreezer
How bad is to make frequent allocations, if we're talking on small objects?
For example there are poco class:
class Foo{/*code*/}
and decorator class
class FooWrapper
{
public FooWrapper (Foo wrapped)
{
Wrapped = wrapped;
}
public Foo Wrapped{get;}
/*Decorating Methods*/
}
which has just one auto property only and a plenty of decorating methods. So, allocated objects are really small and contain only one reference. How badly frequent allocations of FooWrapper e.g.
List<FooWrapper> GetListOfWrappedFoo(List<Foo> list)
=> list.Select(it => new FooWrapper(it)).ToList();
can affect efficiency?
I've tried to find an answer on different resourses, but unfortunately I've failed.
c#
memory
memory-management
wrapper
allocation
0 Answers
Your Answer