[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Memory Leak help needed



  We have recently moved our application into the Dynamic Windows and Presentations
world and are having some trouble running out of swap space.  I guess some background
is in order here.  Our application displays vehicles on a map on the color screen.
We get updates about their position via the ethernet about 4 times a minute (15 second
intervals).  When we get an update, we erase the vehicle, update its instance variables,
and then draw it.  In order to present the object on the color screen, so it is
mousable, we have a call to dw:with-output-as-presentation in a whopper on the draw method.
We hold onto the presentation that is returned from this call in an instance variable.
When we erase, we send the window a :delete-displayed-presentation message with the
presentation as an argument.

  The first thing we noticed was that drawing would get much slower after the system was
up for a long time.  We examined the window, and noticed two instance variables that
seemed relevant, DW::DISPLAYED-PRESENTATIONS and DW::DISPLAYED-GRAPHICS.  The fill pointer
for displayed-presentations was equal to the number of vehicles we had (maybe 30).  The fill
pointer for the displayed graphics was somewhere around 15000 on one machine, higher on
another.  So we started examining the displayed presentation that was returned in the
draw whopper.  It has several inferiors which are graphics-displayed-presentations.  So we
changed our erase whopper to not only delete the displayed-presentation, but also to delete
its inferiors by sending a :delete-graphics-displayed-presentation message.  This now keeps
the fill pointers at constant levels, and makes drawing just as fast after a long time as
it was at the beginning.

  But we are still running out of swap space.  Apparently we are not freeing memory
somewhere along the line, or we are freeing it, but it is not being gced.  Any ideas
about where we are losing this memory, or what we need to do to really free this memory,
or why it is not being gced if it isn't free?

  Here is the math, if it helps:

  Assume 30 vehicles are involved.  (this is small, it is common for the customer to
run with 4 or 5 times this amount, sometimes 10 to 15 times this.)

  30 presentations/update * 4 updates/minute = 120 presentations/minute

  120 presentations/minute * ~136 words/presentation = ~16320 words/minute

  ~16320 words/minute * 60 minutes/hour = ~979200 words/hour = ~1 Mw/hour

136 words/presentation = 1 displayed-presentation & 5 graphics-displayed-presentations
  (4 triangles and 1 scaled-line).

Thanks for any comments,
-tom