Re: life-time pinning. vs Global heap
- From: TheMadHatter <TheMadHatter@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 3 Jan 2008 14:46:02 -0800
Yes of course.
I attempted to imply that the gc doesn't try very often
to move large objects so the gc performance penelty
for pinnin will be reduced.
Thanks again.
"Chris Mullins [MVP - C#]" wrote:
Don't assume that because the LOH isn't compacted today, that it won't be in.
the future.
Be sure to pin whatever you allocate, so that you're future proof. It would
suck to have a customer installed a Service Pack, and have your app break.
--
Chris
"TheMadHatter" <TheMadHatter@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:F4115F14-5045-41F6-A3FB-2FDC4E82D727@xxxxxxxxxxxxxxxx
Thanks Chris.
I didnt know about the ArraySegment<T> :D
Oh yea... and the Large Object Heap.....
It has a tendency not to move objects as well. humm.....
Once again thanks for the insightful answer. :) :) :)
"Chris Mullins [MVP - C#]" wrote:
My personal experience is that the best bet is to:
- Allocate a big byte array at the start of your program. This ends up
coming out of the Large Object Heap.
- Pin the array using the GC Handle.
- use ArraySegment<T> to partition the big array during the lifetime of
your
app...
--
Chris Mullins
"TheMadHatter" <TheMadHatter@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:68646A13-E464-44E2-975A-D2445D163828@xxxxxxxxxxxxxxxx
I am very sorry to bring a topic up that has been beaten with an ugly
stick..... but...
If I want to "fix" an byte array for the life time of a program would
it
be
better allocating it on the unmanaged heap?
Yes I know that if I am to pin the object for long periods of time,
that
it
would be best to do it at the very initial start of the program so that
it
prevents some fragmentation of the managed heap.
Thanks in advance for your thoughts on the matter.
- References:
- Re: life-time pinning. vs Global heap
- From: Chris Mullins [MVP - C#]
- Re: life-time pinning. vs Global heap
- From: TheMadHatter
- Re: life-time pinning. vs Global heap
- From: Chris Mullins [MVP - C#]
- Re: life-time pinning. vs Global heap
- Prev by Date: error on script page
- Next by Date: Re: The DoubleClick event
- Previous by thread: Re: life-time pinning. vs Global heap
- Next by thread: strange
- Index(es):
Relevant Pages
|