Why Open Source is amazing; The story of the Quick Open Bespin feature Event Driven Architecture in JavaScript is fun; Bespin Extensibility
Mar 23

Debug the memory usage of your Ajax application

Ajax, Mozila, Tech with tags: Add comments


Do you remember when Web applications were CGI scripts? You had that cheeky bit of Perl that would be exec’d away. It was a haven for the lazy among us. What if you didn’t close the DB connection down perfectly? Didn’t matter. Use too much memory? Who cares. The process would die in seconds!

I then remember the real Web 2.0, when mod_perl and the like came about (yah yah there was NSAPI/ISAPI which I had to deal with too) and you realized that all of that bad programming now came at a price. The applications would be sitting on the server for a long time, so you could share a lot, but if you were sloppy you could cause bad things. Now you have to audit the code and gets thing right (as well as working around mod_perl bugs, but that is another story!)

The same has happened with the world of Ajax. Applications that used to be pages that would be refreshed are now replaced by sites like Gmail that sit in a browser tab all day long. If your application does something a little bad now, it can be noticed.

This is where the post that Ben just made on a new
memory tool for the Web comes in. As we write Bespin and other Web applications we feel the pain where we wish certain items weren’t as much of a black box as they are now in the browser. A first bite is memory, and being able to get some visibility into the heap, or see when the garbage collector is kicking in and how long it is taking.

What other tools like this would you like to see as you write long living Ajax applications in the browser? We are all ears!

5 Responses to “Debug the memory usage of your Ajax application”

  1. anjan bacchu Says:

    hi dion,

    memory : it would be nice to know what happened to “phantom” memory — zombie blocks of memories.

    Also, it would be nice if we could know how much memory is being occupied by a particular application at a given point of time — aka memory graph.

    GC : will we get to have #pragma like directives to the GC ? OR is that too much for js ?

    thank you,


  2. David Semeria Says:

    Memory management and HTML element event transparency are the two biggest problems currently holding back ajax-based apps.

    It’s really quite annoying that no-one thought to implement a dealloc() constructor, even just to give the garbage collector a hand.

  3. Powell Says:

    Good sharing.It will surely help programmer.

  4. Christopher Blizzard Says:

    Real men wrote their first cgi handling libraries in C. Sucka.

  5. dion Says:


    Hahah, oh I made my share of segfaulting CGI :/

Leave a Reply

Spam is a pain, I am sorry to have to do this to you, but can you answer the question below?

Q: What is the number before 3? (just put in the digit)