groue / GRMustache.swift

Flexible Mustache templates for Swift
http://mustache.github.com/
MIT License
601 stars 154 forks source link

Memory leaks #14

Closed njdehoog closed 8 years ago

njdehoog commented 9 years ago

Hey @groue, it's me again ;) Have you ever noticed any memory leaks in the framework? I have some memory leaks in my app, and when I use Instruments to track down the leak, it seems to point to GRMustache as the source:

screen shot 2015-10-21 at 16 24 00

I spent a bunch of time trying to figure out what could be the root cause, and if maybe I was doing something wrong that would cause this issue, but I can't figure it out. Do you have any ideas maybe?

groue commented 9 years ago

Oops. Let me check.

njdehoog commented 9 years ago

Note that I can't reproduce the issue in the sample app.

groue commented 9 years ago

I may have to ask you some sample code. We're not there yet.

njdehoog commented 9 years ago

I was afraid you were gonna said that ;) I'll see if I can isolate the problem in a sample project. This might take a while...

groue commented 9 years ago

Don't do it now, let me try to reproduce first!

njdehoog commented 9 years ago

Too late. I've copied some stuff over from my project and I was able to reproduce the issue. Try profiling the OS X demo app and you should see the memory leaks after rendering.

Here's the debug project: https://www.dropbox.com/s/inttwlrhqgde2z3/GRMustache.swift.zip?dl=0

groue commented 9 years ago

Thanks Niels :-) OK I'm looking at that very soon. Hold on!

njdehoog commented 9 years ago

Sounds good :+1: Let me know if I can help.

groue commented 9 years ago

Thanks for your sample code, I can reproduce the leak. It's pretty tricky, actually! Still investigating :-)

groue commented 8 years ago

@njdehoog I have good reasons to think that these leaks come from Swift itself. I expect them to vanish with Swift 3.