leaking arrays and how to use introspection to see into them?

  1. 2 weeks ago

    James S

    May 19 Testers, Xojo Pro

    Good morning!

    I have a memory leak in an app that seems to be leaking arrays which is a bit of a mystery to me unless I have an array of arrays somewhere that I’m not remembering or unless the array holds an object that holds a reference to the array or something interesting like that which is possible. But then I would expect to see a leak of those objects as well which I am not able to track.

    I have a debugging method in the app that I can call which uses introspection to walk all the objects currently alive in the program and counts them by type so I can see that my app has 53791 array objects in it at the moment up from 53170 just 15 minutes ago. The numbers do not increase regularly, they are definitely in response to something the program is doing but I’ll be darned if I can figure out where they are.

    I thought it might help finding just where they are going missing if I could also use introspection to find out what property type is being held in the array or something like that. Not having used introspection for anything in my life other than the object counting method mentioned above and cutting and pasting the exception handler example from the language reference I’m evidently not familiar enough with it to get this to work. I seem to be having problems this morning even getting some of the example code from the language reference to even compile for me.

    Any suggestions on how I might get more info out of these array objects, what they are, what their parent objects or modules are that would be very helpful!

    Thanks,

  2. Jürg O

    May 19 Testers, Xojo Pro

    Just asking before you're going to do this all on your own and start learning Introspection or whatever... have you had a look at Xojo Instruments ?
    That's an easy drop-in and gives you most/all of what you need, ready to use in a GUI...

  3. James S

    May 19 Testers, Xojo Pro

    heh, nevermind ;) I no longer think I am leaking the things. I think there was just a lot more data in the code that provides for mouse over display of data in some rather large graphs than I thought. When you startup of course there may not be as much data in it so it grows quite a bit as you watch, but it seems to settle down and I can make it grow and shrink quite reliably by changing what is being displayed.

  4. James S

    May 19 Testers, Xojo Pro

    @Jürg O Just asking before you're going to do this all on your own and start learning Introspection or whatever... have you had a look at Xojo Instruments ?
    That's an easy drop-in and gives you most/all of what you need, ready to use in a GUI...

    And that looks fantastic! I had actually seen some references to that before but hadn’t downloaded it or experimented with it. I am definitely going to now though!

  5. Jürg O

    May 19 Testers, Xojo Pro

    @James S And that looks fantastic! I had actually seen some references to that before but hadn’t downloaded it or experimented with it. I am definitely going to now though!

    It is... ;)
    Do something in your application, let Xojo Instruments do a "capture". Then do something else where you expect not having increased any object count. Then "Capture and Compare". And Xojo Instruments provides a nice sorted ist of what Objects have been added/removed. If a lot added, you can even "show the object in the debugger" to see what they are, see their backtrace, and so much more.
    It's helped me a couple of times to track down a memory / reference count related issue...

or Sign Up to reply!