WilhelmOks / VoronoiLibSwift

Swift implementation of Fortunes Algorithm.
MIT License
7 stars 2 forks source link

Memory leak #2

Open nachoburr opened 1 year ago

nachoburr commented 1 year ago

Hi, this is working well but creates zombies.

WilhelmOks commented 1 year ago

I'll take a look at it.

WilhelmOks commented 1 year ago

I checked it with the profiler and it looks like the VEdge is the problem. But I can't find an obvious reason why.

nachoburr commented 1 year ago

Yeah, I wasn’t sure. But it adds up. :( beach line may also be an issue; did you look for zombies?

On Sat, Apr 22, 2023 at 4:40 AM WilhelmOks @.***> wrote:

I checked it with the profiler and it looks like the VEdge is the problem. But I can't find an obvious reason why.

— Reply to this email directly, view it on GitHub https://github.com/WilhelmOks/VoronoiLibSwift/issues/2#issuecomment-1518621363, or unsubscribe https://github.com/notifications/unsubscribe-auth/ASZ4IEEXFMHAM3I63KCE2ULXCO7SLANCNFSM6AAAAAAXBLYTFM . You are receiving this because you authored the thread.Message ID: @.***>

WilhelmOks commented 1 year ago

I used the Zombie profiler but from what I have read, Zombies are over-released objects, so they wouldn't cause memory leaks.

What I found is, that many objects stay in memory and are never released even if the screen is reset it the test app. The first object that was directly from the lib was VEdge, so this is a possible candidate for memory leaks but it could also be something else and VEdge is just a symptom instead of the cause.

There is also the chance that the leak is actually in the sample app and not in the library itself.

I'm not very experienced in analyzing that kind of stuff and the fact that I more or less blindly copied the logic from the original C# lib, which has garbage collection, also makes it difficult. It was also more than 3 years ago.