Hi,

In my current project we have a page with six AjaxLinks that open
different ModalWindows. We had implemented sub-classes of ModalWindow
which had field references to the content Pages (the source of the
iframes in the ModalWindows) created by ModalWindow.PageCreators. The
references were there to extract state from the Pages when the
ModalWindows were closed. The Pages also had field references to the
ModalWindows in order to call close on them.

Using this design, the serialization/deserialization increased
seemingly exponentially for every opened and closed ModalWindow,
causing a gigantic memory leak. After opening and closing a number of
ModalWindows, a single close could consume an additional ~70 MB of
memory.

Also, in some situations the Page.numericId was zero in
Page.writeObject, causing a ClassCastException when the Page field
references were deserialized. Since the numericId was zero, the wrong
Page (the initial Page) got deserialized.

As far as I have been able to understand what's happening, the
problems arise because of the cycles between components and the fact
that the Pages are deserialized using different ObjectInputStreams.
I'm not sure how the numericId could become zero.

Removing the references to the content Pages from the ModalWindow
sub-classes and using simple Models instead seems to have solved both
problems.

Questions:

What is happening in the serialization/deserialization when this
behavior arises?

How can the numericId become zero in Page.writeObject (and
sub-sequentially in Page.readObject)?

Is it generally problematic to have field references to Pages in
Components (or objects)?

What would the most decoupled approach (object graph wise), thus
minimizing serialization, be to implementing this?


Thanks,
Henrik Lundahl

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to