Re: life-time pinning. vs Global heap

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



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.


.



Relevant Pages

  • Re: Cons cell archaic!?
    ... from s-expression or XML or other syntax you keep the bloated array ... For using vectors to emulate lists that ... Allocate 2, move 1 element: ... What do you think of that algorithm? ...
    (comp.lang.lisp)
  • Storing/Retrieving TYPEs with ALLOCATABLE components (TR) (long)
    ... tBrd, including array descriptor of tEn )). ... Without previous DEALLOCATE, the allocate line fails at run time with message ... the fact that I'm loading an invalid descriptor tBrd%tEn from the file... ... status (which is not possible according to Standard, but then BINARY files ...
    (comp.lang.fortran)
  • Re: Storing the size of an array in the structure itself
    ... >> I think every C programmer can relate to the frustrations that malloc ... >> the size of an array must be stored separately to be a nightmare. ... is anything more than just that - a chunk of memory. ... > Otherwise you couldn't tell it how much to allocate. ...
    (comp.lang.c)
  • Re: segfault with large-ish array with GNAT
    ... specifically) would be smart enough to allocate memory for large ... using pointers (and thus take the memory from the heap). ... the array is not in the heap in this case; ...
    (comp.lang.ada)
  • Re: life-time pinning. vs Global heap
    ... Be sure to pin whatever you allocate, ... coming out of the Large Object Heap. ... Pin the array using the GC Handle. ...
    (microsoft.public.dotnet.languages.csharp)