Re: Garbage collectable pinned arrays!
- From: Jesse McGrew <jmcgrew@xxxxxxxxx>
- Date: Tue, 12 Feb 2008 03:28:57 -0800 (PST)
On Feb 11, 11:51 pm, "Atmapuri" <janez.makov...@xxxxxxx> wrote:
Hi!
It would be great, if the pinned arrays would be garbage
collectable. This would greatly reduce the amount of copy
back and forth the managed and unmanaged memory.
I cant think of a single reason, why the GC should not allow
this.
It would be also great, if the memory could already be allocated
as pinned:
double[] array= new pinned uninitialized double [500];
where uninitialized would mean that it is not set to zero, thus
saving processing power where GC pressure is high.
As I understand it, pinning is an attribute of the *reference*, not
the object itself. The object is pinned when there's a pinning
reference to it anywhere on the call stack.
Thus, it doesn't make sense for a pinned object to be garbage
collectible. The object can't be considered garbage anyway while
you're still holding a reference to it, and once you let go of the
last reference, it's no longer pinned.
I don't see why you'd even want it to be collectible, actually. The
point of pinning is to let unmanaged code access the object without
worrying that the GC will move it. But collecting the object and
letting its memory be used for something else is just as dangerous as
moving it!
Jesse
.
- Follow-Ups:
- Re: Garbage collectable pinned arrays!
- From: Atmapuri
- Re: Garbage collectable pinned arrays!
- Prev by Date: Re: Accessing Object Members In An Array List -- Syntax & Guidelines Help Please
- Next by Date: Re: Graphics presentation
- Previous by thread: Re: Garbage collectable pinned arrays!
- Next by thread: Re: Garbage collectable pinned arrays!
- Index(es):
Relevant Pages
|
Loading