1. Markus Eckert
  2. PowerBuilder
  3. Wednesday, 6 September 2023 11:52 AM UTC

Hi everyone

I'm trying to chase down a memory leak in our application (PB 2022 1900) that appears to happen when a window is repeatedly opened and closed. (Symptoms: When I open a window inheriting from our base window class, used memory increases by X, when I close the window, it only decreases by Y (which is less than X). When I open a window inheriting from a base window, this problem doesn't occur, so it must be something in our code)

What I've tried so far:

  • Look for suspect code in our base window class. -> Haven't found anything obvious, but that code definitely deserves to be considered guilty until proven innocent ;-)
  • Check the debugger tab "Objects in memory" before and after repeatedly opening and closing the window. -> No difference found
  • Start a profiler trace on the activities "ActObjectCreate!" and "ActObjectDestroy!" and check the "Profiling class view" for classes showing more creates than destroys. -> Even after opening and closing the window a dozen times, I haven't found any class with more than 1 "create surplus". Conversely I've found several classes with quite a few more destroys than creates.
    • This has led me to believe that the problem might lie in some objects getting duplicated when passed as arguments (which I assume wouldn't call the constructor for the copied object but both copies could get destroyed seperately later)

Does anyone have any good ideas on how I else I could track down objects that aren't getting properly cleaned up when the windows are closed.

Or (if my suspicion about objects possibly getting duplicated somehow is reasonable) how to find out where that happens.

Regards,
Markus

Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Wednesday, 6 September 2023 12:03 PM UTC
  2. PowerBuilder
  3. # 1

Hi Markus;

  Yes, all large strings, arrays, blobs & objects should be passed by REF wherever possible. Otherwise, huge copied storage work areas are created by the PBVM that need to be also cleaned up on top of your destroys.

Regards ... Chris 

Comment
There are no comments made yet.
Miguel Leeuwe Accepted Answer Pending Moderation
  1. Wednesday, 6 September 2023 11:59 AM UTC
  2. PowerBuilder
  3. # 2

Hi,

You haven't told us which PB version you are using, but I would start by searching on the word "leak" in this Q&A forum and also on the support site:

https://www.appeon.com/standardsupport/search

There's a bunch of incidences.

regards.

Comment
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.