Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Windows can be configured to allocate more page file space on demand, or <a href="http://windowshelp.microsoft.com/Windows/en-GB/help/89ca317f-649d-40a6-8934-e5707ee5c4b81033.mspx" rel="noreferrer">on request</a>.<br> <a href="http://msdn.microsoft.com/en-us/library/system.activities.design.base.propertyediting.editorreuseattribute(VS.100).aspx" rel="noreferrer">Job objects</a> can prevent the consumption of more than a certain amount of memory.<br> Fragmentation of the heap and the generational nature of it (plus the need to put large stuff in the Large Object Heap) </p> <p>All these mean that the hard limit is not much use in reality and means answering the question "how much memory could I theoretically allocate" is rather more complex than you think.</p> <p>Since it is complex anyone <em>asking</em> that question is probably trying to do something <em>wrong</em> and should redirect their question to something more useful.</p> <p>What are you trying to do that would appear to necessitate such a question? </p> <blockquote> <p>"I just want to know when the current memory load of the process could get problematic so I can take actions like freeing some items of a custom cache."</p> </blockquote> <p>Right. this is much more tractable a question.</p> <p>Two solutions in order of complexity:</p> <ol> <li>Make your caches use <a href="http://msdn.microsoft.com/en-us/library/system.weakreference.aspx" rel="noreferrer">WeakReferences</a> <ul> <li>This means that things will be freed by the system almost magically for you but you will have little control over things like the replacement policy</li> <li>this relies on the cached data being much bigger than the key and the overhead of a weak reference</li> </ul></li> <li>Register for <a href="http://msdn.microsoft.com/en-us/library/cc713687.aspx" rel="noreferrer">notification of Garbage Collections</a> <ul> <li>This lets you take control of freeing things up.</li> <li>you rely on the system having the appropriate maximum size for the GC generations which may take a while to get to a steady state.</li> </ul></li> </ol> <p>Points to note. Is it <em>really</em> less expensive to maintain this massive cache (going to disk by the sounds of it) than to recalculate/re-request the data.<br> If your cache exhibits poor locality between commonly/consecutively requested items then much effort will be spent paging data in and out. A smaller cache with an effective tuned relpacement policy stands a good chance of performing considerably better (and with much less impact on other running programs)</p> <p>As an aside: In .Net, no variable sized object (strings, arrays) can be more than 2GB in size due to limitations of the core CLR structures for memory management. (and either solution above will benefit from this)</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload