Wednesday, 23 October 2013

Solution for the memory fragmentation in .Net LOH

I don't really blog here about current technical questions. The reason is that most of the posts would be outdated in a year or two. But this one is a "breaking news" and it's worth a post. Short technical background:
Most developers assume that because of Garbage Collector (GC) they don't have to deal with the memory in .Net. It is true. Most of the time. But it is ALWAYS worth to learn what's going on behind the curtains. And if one digs into the details of GC, they will find at least two possible issues: pinned objects and the fragmentation of the Large Object Heap (LOH). The specialty of LOH is that it is not compacted when GC happens, so it can become fragmented over time and cause OutOfMemoryException even if the numbers say that you are far below your memory limits. Maybe you never experienced this. And maybe you didn't because IIS regularly restarts your processes. Another "dive deeper" topic. Anyway. .Net 4.5.1 has a solution. Or more precisely: it gives you the power to address the LOH fragmentation. It is not automatic. You have to deal with it. But now, at least you can.

Wednesday, 2 October 2013

Do you need JavaScript libraries?

I know jQuery. Now what? by Remy Sharp is a great reading. Just recently also John Papa had some thoughts about how we are overwhelmed with all the libraries we have today. Web development is a very rapidly changing field. Best practices of two or three years ago are not recommended anymore, popular libraries are losing their edge while others emerge to replace them, and Internet Explorer version 9 and above kind of does the job of a web browser.
The question is, of course, provocative. The right questions are: When do you need JavaScript libraries? and Which libraries do you really need? In some cases maybe all you need is JavaScript with Vanilla JS. In other cases you might need jQuery and nothing else.
Think twice before you add another library just to use one single feature it provides, or before you learn yet another templating library whilst John Resig's micro-templating solution might serve your needs.
I am currently working on a Chrome extension. I can't justify to myself using any libraries for that. It runs only in one browser and that one supports all the latest standards. It is a special example of course, but the point is: don't automatically start all your web projects with
<script src="jquery"...