.Net: Prevent an object from being paged out (VirtualLock equivalent)

Posted by Gene on Stack Overflow See other posts from Stack Overflow or by Gene
Published on 2009-09-25T16:50:43Z Indexed on 2010/04/02 20:13 UTC
Read the original article Hit count: 364

Filed under:
|
|
|

How would one go about keep an object in memory such that it won't be paged out by the OS in .Net?

i.e. Something similar to VirtualLock, but operating on an object, such that if compacting occurs and the object is moved it still would not be paged out, etc.. (I suppose one could pin the object's, determine what pages it belongs to, and then VirtualLock those pages, but that seems non-desireable for many reasons.)

If possible, could you point me to a reference or working sample? (C# ideally)

Many thanks in advance!

© Stack Overflow or respective owner

Related posts about .NET

Related posts about memory-management