Hi. I would like some tips on finding circular interface references (yeah - a lovely topic). At work, the legacy application (2M lines, including 3rd components) has developed a memory leak that I believe is because of a circular interface reference but only when a certain process is ran. Just to add salt to the wound, it is a mixture of interfaces and objects, with a side dish of class helpers and a circular reference (uses clause) helper - when we stuff things up, we do it big :-D

Hi. I would like some tips on finding circular interface references (yeah - a lovely topic). At work, the legacy application (2M lines, including 3rd components) has developed a memory leak that I believe is because of a circular interface reference but only when a certain process is ran. Just to add salt to the wound, it is a mixture of interfaces and objects, with a side dish of class helpers and a circular reference (uses clause) helper - when we stuff things up, we do it big :-D

So, what tips and tricks have people learnt over the years to deal with this type of thing?

Comments

  1. Vincent Parrett We do have a work grown weak reference class that is used but it looks like that someone (hopefully not me) added an extra object to the hierarchy of objects that completed the circle :-(  With the number of people being added to the Delphi code base (majority of them haven't touched Delphi before), and most programmers don't use the (limited) tools available to us - it is a wonder this hasn't happened before.

    On the topic of ARC, people at work would love it to be available too - but I can't see it happening until the compiler goes to LLVM.

    ReplyDelete
  2. Well I just spent the last few hours dealing with a reference counting issue myself. Pro tip : beware of passing anonymous functions out of reference counted objects to other long lived reference counted objects, because the closure causes an addref to that object.

    ReplyDelete
  3. Vincent Parrett Had the same trouble with anonymous functions capturing a reference some days ago...and found the problem within minutes with https://github.com/AquaSoftGmbH/RefCountTracer

    ReplyDelete

Post a Comment