Announcement

Collapse
No announcement yet.

Call Stack Frustration! (Objects not being destroyed?)

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Call Stack Frustration! (Objects not being destroyed?)

    This problem is really driving me crazy!

    I'm using the WOTGreal debugger, and the nuttiest things have begun to happen in the background. Specifically, I have these objects that are mounting in the call stack, and I have no idea why!

    The objects that are being created are spawned only on one line of code... something like this:
    Code:
    // destroy old task
         if ( Task != none )
              Task.Destroy();
    
         // spawn the task
         Task = Spawn(CT);
    So obviously, I should be destroying the previous "Task" before spawning a new one.

    WOTGreal tells me differently, however. The call stack keeps creating new instances (like a memory leak) over time that add up. Does anybody have any idea why these are seemingly hanging around?

    The fact that these are mounting is leading to some really strange behaviour! (functions are being called in random classes seemingly without cause). I have a feeling it's due to the fact that many classes are hanging out simultaneously in the call stack.

    Any help would be GREATLY appreciated, as this problem is just killing my mind.

    Thanks in advance...

    #2
    Correct me if I'm wrong, but as I understand it the garbage collection only runs in between maps, so objects created won't be collected until the GC runs, destroyed or not. I'm sure there are some nuances and workarounds I'm not familiar with, but you might try to code in such a way that avoids using a large number of small objects to prevent overhead.

    Comment


      #3
      calling Destroy() will flag the actor to be destroyed in the next tick (e.g. bDelete=true)

      Comment


        #4
        Since these objects are called "tasks", is it possible that they're executing some lengthy operations? As I understand it Destroy won't halt or prevent execution (at least when it is immediately called). Perhaps have whatever is executing in these tasks watch for bDeleteMe.

        Destroy also calls the actor's EndState and Destroyed events, as well as the owner's LostChild. Perhaps ensure that there's nothing amiss in those areas.

        Comment


          #5
          I've looked back through my code, and can't really find anything wrong. Before trying to destroy them, I've put them into the null state. No functions are being called within them, they just seem to sit there.

          Is it possible that the call stack doesn't accurately reflect the objects actually in memory? If I run an iterator, the objects don't show up, but they remain in the call stack.

          Comment

          Working...
          X