[Bese-devel] possible memory issues with UCW

mrd mdanish at andrew.cmu.edu
Sun Jul 16 18:19:46 UTC 2006


I had a short discussion on IRC about this, a quick summary:

* I'm noticing that my application is slowly increasing its
 dynamic-space usage over a period of time, and eventually it seems to be
 hitting the top and crashing.

* The backtracks list on some standard-session-frames is growing to be
 on the order of 4000 in length for some users.

* In addition, the frames table count was around 200 in the
 standard-session.

* Primary resource usage comes from simple-character-strings by far and
 then cons objects in 2nd.  Everything else is below code objects.

* I'm using SBCL in Linux 2.4.

I'm not sure what causes this, or whether the problem is with my code or
UCW.  I was asked if I did anything special with containers, which I do:

I use a container based on tabbed-pane for the main menu of user
interaction.  It's subclassed and modified such that the "tabs" are in a
side-bar and it displays the current-component in the rest of the
screen.  For a while, you could switch between tabs without losing your
state in another tab, which I thought was great but... users insisted on
"normal web semantics" for this container, which means that it must
start with a fresh component every time you click on a tab.

So, I concocted this:

(defcomponent admin-menu (tabbed-pane)
  ((original-contents :accessor original-contents))
  (:default-initargs :current-component-name (caar (admin-menu-contents))
    :contents (admin-menu-contents)
    :template-name "admin-menu.tal"))

(defmethod shared-initialize :after ((c admin-menu) slot-names
                                     &rest initargs &key contents)
  (declare (ignore initargs slot-names))
  (setf (original-contents c) contents))

(defaction switch-component-using-original ((c admin-menu) label)
  (switch-component c label)
  (setf (find-component c label)
        (make-instance (class-of (cdr (assoc label (original-contents c)
                                             :test (container.label-test c)))))))


Another component takes care of displaying the sidebar and making calls
to switch-component-using-original.

As you can see, whenever a user clicks on a sidebar tab they invoke
switch-component but also (setf find-component) which creates a new
instance of the component to which is being switched.

Not really understanding how the backtrack mechanism works, I think I
could have easily caused trouble with it with code like the above.
Though, I don't really know.




More information about the bese-devel mailing list