-
Notifications
You must be signed in to change notification settings - Fork 511
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Overriding method in bounded class causing memory leak #8321
Comments
How are you measure memory usage / leaks? Are you waiting on the garbage collector to collect the managed instances, or are you just hitting the button over and measuring? Unlike ObjC, C# uses a garbage collector so memory isn't immediately freed when popping a controller. |
sure, I'm aware about To answer your question - using memory graph as well as instruments, which shows memory spikes, there's a screenshots attached in the OP |
It is very helpful, in particular on tricky issues like "memory leaks", where false positives are exceptionally easy to find, for the sample to accurately show how you are measuring things. Can you please attach a sample with whatever memory management techniques you use to handle garbage collection and collect your number? For every actual reported memory leak I see 5 where people misunderstand what they are measuring, GCs make things less obvious than one would first expect. |
Hello Chris, The problem isn't in the garbage collection, the issue is that it works fine If no methods were overridden, and doesn't it there some. There's no fancy techniques to be used in this simple project, everything is disposed, events' are unsubscribed etc... this test project contains only 2 view controllers and native class with overridden method, and that's only to be able to showcase increasing memory... I'm trying to think simple here, there are 2 cases for the native class used:
First one, works with no problems, and second causes increasing of memory usage each time. I understand, that there are a lot of false positive reports, and that's why prepared simple project right in the OP, so you can just "click and run" it, and see the problem i'm talking about. I'm not saying that's there is a bug or an issue in Xamarin.iOS, but there's something going on related to binding's generator and overrides. Also, Ш'm not omit the fact, that I might miss something, but the project is very very simple, so it's either I'm doing something wrong, or there's the issue in "under the hood" code. Hence - asking here. But anyways, since you asking how I measure, I decided to slim the project, and include GC code. You can find it below: In this example, there's only appDelegate, with simple code (2 cases)
Since c# collector doesn't know about native object, and only know about references, I used XCode to check memory. So here's what I did for each case:
Case with override: In addition, you can find data from the Hope that helps and you might be able to bring some insights about what's wrong with this example. Thanks in advance! |
@chamons is there anything else I can do, so you can let me know what am I missing here? |
Taking a look into this is on my backlog plate, we've just been a bit swamped. |
@chamons hello. Did you have a chance to look into this? |
No, I was not able to make much progress on it recently. Given the soon release of Xcode 12 Beta it may be awhile. Apologies. |
maybe there's some timetable or deadline, so we are aware of what to expect...? |
While many problems can be resolved over github issues given sufficient time, they are prioritized based upon broad customer impact. Because of this, it is not possible to lay out a timetable or deadline on when we'll be able to get back to looking on this, specially with Xcode 12 work beginning this summer. If you are eligible for business supports requests with Microsoft, you can consider submitting a support request to the Xamarin support team. |
+1 for this issue. It's affecting our customers at SciChart - a fast iOS and Xamarin realtime chart control. If we get customer issues reporting can we point them here to log / vote for the issue? |
hello @chamons, since XCode 12 is released already, maybe there's a time to look into this issue? |
any updates with regards to this issue? |
As the title stands, we've faced memory leak, caused by overriding bounded class.
Setup we have:
Everything is described and attached below. If you need more information, or anything else I can help to reproduce, found the reason - let me know.
Steps to Reproduce
TestProjectConsumer
appbutton
.< back
to pop backSpikes on the memory graph reflects each time view controller was pushed.
Please see some screenshots under the spoiler:
Expected Behavior
Actual Behavior
Environment
Build Logs
Example Project (If Possible)
For the sake of simplicity, test project is simple view controller which push another one, with Native object inside it. This makes possible going back\forth to clearly see the leak.
TestProjectAndBindingLib.zip
I might miss something, if so - please let me know, any suggestions is greatly appreciated.
Thank you in advance!
The text was updated successfully, but these errors were encountered: