Re: Garbage collectable pinned arrays!
- From: "Ben Voigt [C++ MVP]" <rbv@xxxxxxxxxxxxx>
- Date: Tue, 12 Feb 2008 10:00:21 -0600
The array is automatically allocated on the heap once it exceeds
a certain size and thu's becomes "pinned", because the heap is
never compacted and all addresses are absolute.
Arrays that exceed a certain size (85Kb currently), are moved to the
Large Object Heap, but they aren't pinned by this. The LOH is not
compacted, but that doesn't mean that the objects cannot get
collected.
All objects on the LOH are pinned at all times, by the nature of the heap
(non-compacting).
It would be useful to request that a particular buffer not be subject to
relocation by the GC. Probably the easiest way to do this would be to place
it in the LOH. The OLE task allocator or HGlobal allocator, both of which
are already exposed by the Marshal class in a typeless way, would be other
options. It could be as simple as adding a T[]
Marshal.AllocCoTaskMem<T>(int elementCount) override.
.
- Follow-Ups:
- Re: Garbage collectable pinned arrays!
- From: Willy Denoyette [MVP]
- Re: Garbage collectable pinned arrays!
- References:
- Re: Garbage collectable pinned arrays!
- From: Jesse McGrew
- Re: Garbage collectable pinned arrays!
- From: Atmapuri
- Re: Garbage collectable pinned arrays!
- From: Willy Denoyette [MVP]
- Re: Garbage collectable pinned arrays!
- Prev by Date: Re: Reflection and Arrays
- Next by Date: Re: Garbage collectable pinned arrays!
- Previous by thread: Re: Garbage collectable pinned arrays!
- Next by thread: Re: Garbage collectable pinned arrays!
- Index(es):
Relevant Pages
|