memory leak in RenderingContext #192
Description
RenderingContext.render
builds a buffer of rendered elements. For example:
DIV do
SPAN { 'span 1'}; SPAN { 'span 2' }; SPAN { 'span 3' }
end
rendering the DIV adds the three SPANs to the DIVs rendering buffer.
As each render completes the buffer is packed up as a the children of the element being rendered, and the newly rendered element is pushed onto the parents buffer...
So we have a stack of these buffers.
The problem is nobody ever clears the top most rendering buffer, so after each rendering cycle all of the top most renders children remain in the buffer, and the buffer just gets longer and longer.
There is a bunch of complications between how the buffer is managed to allow for nodes to be pulled from the buffer, etc, so the fix that I propose is kind of ugly:
Just use a class instance variable to detect if its an outer most render, and if it is, then reset the buffer in the ensure block.