[rabbitmq-discuss] RabbitMQ management plugin memory usage in Chrome

Marek Majkowski majek04 at gmail.com
Thu Jan 27 08:59:07 GMT 2011


On Wed, Jan 26, 2011 at 23:15, Simon MacMullen <simon at rabbitmq.com> wrote:
> On 25/01/2011 9:14AM, Jon Rowland wrote:
>>
>> I don't have Firefox but I tried this in IE 8.0 and get the same
>> behaviour (1GB usage after leaving running overnight).
>
> Hmm. Not sure IE counts as much evidence for the bug being in the plugin :)
>
> But seeing the same problem in two browsers is a concern.
>
> But I still have no idea how to debug this kind of problem.
>
> But I'll have a look anyway.
>
> But I'm not promising anything.

Simon,

There definitely is a memory leak. Actually, not a memory
leak - it's just the document that is growing, the
elements aren't leaked, they are referenced somewhere.

I did some debugging and I have some results.
Though, there is probably still much to be said.

1. in main.js we use innerHTML in one place, it's helpful to
    zero the element out before that:
http://javascript.crockford.com/memory/leak.html

2. I modified the purge() function above to unlink all childs,
   and it seems to work a bit better. (ie: explicitly unlink all
   elements of the tree)

3. The single biggest thing is IMO broken element caching
    in jQuery. Check out jQuery.fragments. It's growing...
    Removing this cache by hacking jQuery brought
    wonderful results. (there is also jQuery.cache, but
    I haven't played with that).
    Basically, in one of the tests I noticed that Dom nodes
    "document-fragment" were using the majority of memory.

4. In the queue view  there is a gc-cycle in the <form>
    responsible for adding a queue. I'm not sure what
    can be done about that.

5. In some other test I noticed that "slideUp/Down" and
    "toggleUp/Down" methods were increasing memory
    usage significantly, but that may be a false lead,
    as it may have something to do with the 'document-fragment'
    issue mentioned above.

6. For debugging I used 'sieve' for IE.
      http://home.wanadoo.nl/jsrosman/
    It's a simple tool but allows traversing the DOM and looking
    at what contains what. It would be nice to find a similar
    tool for chrome and firefox.


Cheers,
  Marek


More information about the rabbitmq-discuss mailing list