Daily Archives: January 24, 2004

Whidbey BCL the Easy Way: Memory Pressure

I thought I would share some of the things I am putting in my talk. They may already be old news to some of you (which seems such a funny statement considering the product is only in alpha!) but to those of you who haven’t ventured in, I would love to leave a crumb trail to entice you to look further.

The class for Garbage Collection, System.GC, has two new methods: AddMemoryPressure and RemoveMemoryPressure.

Although the way GarbageCollecton works is pretty complex (and fascinating) here’s a simplified explanation. GarbageCollection is triggered by the amount of memory being used by your managed objects and based upon different triggers, it goes and cleans up objects that are no longer being used. If one of those managed objects owns an unmanaged object, that unmanaged object’s memory allocation is not taken into account. Imagine the confusion (and inefficiency and possibly worse…) created when a small managed object instantiates a very large unmanaged object.

Using these new methods, you can add or remove a value that is used in the GC’s calculations that help trigger it’s functionality. The value that you pass in could literally represent the size of the unmanaged object, or just be your own value that helps to almost “rate” or “rank” the priority of the object.

If you don’t have the Whidbey alpha, you can still read more about these methods online in the SDK Documentation. AddMemoryPressure  RemoveMemoryPressure . I have to say that the explanations in the documentation are really very clear and I recommend that you look into them for further details. Also Brad Abrams wrote a much more indepth explanation of Memory Pressure in December.

Jason Salas reads a lot of tech books

I always notice that Jason Salas posts lots of reviews on the AspAdvice forums and on his blogs. I think that he puts them on the ASPAlliance site also.

We get a lot of books from publishers coming to our user group. We even have a book review page! I do have the opportunity to grab what I want before I push them out to my members. Usually I just ask if I could get my hands on them afterwards. But I generally find I don’t ever have time for leisurly reading as opposed to being VERY happy to have these books around when I am trying to learn a particular thing or solve a problem. I would love to be able to find the time to do what Jason does, which is why I always notice when he posts yet another book review.

Werner Vogels’ journey into the Bleeding Edge of Hardware

Werner got a way-cool laptop. The kind a rocket scientist should have! But he’s already having second doubts about it.

I wonder how his laptop compares to the Longhorn machine that Clemens Vasters is now toting around Europe.