These are chat archives for AvaloniaUI/Avalonia

27th
May 2016
danwalmsley
@danwalmsley
May 27 2016 09:33
@grokys one recent change has introduced a ridiculous memory leak!
after updating to latest version
just moving mouse across my application causes 100s of mbs to be lost in seconds!
Steven Kirk
@grokys
May 27 2016 09:35
wow - latest version on master?
danwalmsley
@danwalmsley
May 27 2016 09:35
yeh
I don't know if it happens on test application
yes it does
Steven Kirk
@grokys
May 27 2016 09:35
hmm, i wonder what's changed in the meantime?
danwalmsley
@danwalmsley
May 27 2016 09:35
just load test app
don't click anything
just move mouse around
do you see same thing?
Steven Kirk
@grokys
May 27 2016 09:36
will try that shortly, working right now
danwalmsley
@danwalmsley
May 27 2016 09:36
ok sure
Steven Kirk
@grokys
May 27 2016 09:37
i suspect it's something to do with the new hit testing
danwalmsley
@danwalmsley
May 27 2016 09:37
I updated from 514
alpha
so a fair jump
danwalmsley
@danwalmsley
May 27 2016 09:43
I'm wondering, once we have virtualization and fixed the content control and popup memory leaks, do you think we will be ready to do a release?
Steven Kirk
@grokys
May 27 2016 09:44
yeah i'd like to do a release asap, but we need to get the designer working properly first
danwalmsley
@danwalmsley
May 27 2016 09:45
sure
Steven Kirk
@grokys
May 27 2016 09:45
i've not been paying close attention but i believe there are still issues, in particular with xaml files in PCL/dlls
danwalmsley
@danwalmsley
May 27 2016 09:45
let me know when your looking at the memory leak if I can help diagnose
Steven Kirk
@grokys
May 27 2016 09:46
sure - it might be a little while yet - i really want to finish some work stuff off
danwalmsley
@danwalmsley
May 27 2016 09:46
yeh for me designer has been flaky having xaml inside class libraries
Steven Kirk
@grokys
May 27 2016 09:46
did you get anywhere with finding the ContentControl leak?
danwalmsley
@danwalmsley
May 27 2016 09:46
It got late, so I stopped, but got my test to apply styles
didn't see anything yet
I will get there! sooner or later
Steven Kirk
@grokys
May 27 2016 09:47
yeah, it's often really difficult to repro the exact circumstances that trigger the leak
thanks for taking a look - i will take a look myself if you don't manage but it's all a question of time
danwalmsley
@danwalmsley
May 27 2016 09:48
never enough time mate!
Steven Kirk
@grokys
May 27 2016 09:48
truth
danwalmsley
@danwalmsley
May 27 2016 09:49
id love to help more, but now with baby I get only a few hours a week to spend on Avalon studio/ perspex
Steven Kirk
@grokys
May 27 2016 09:49
yeah, i understand
Steven Kirk
@grokys
May 27 2016 11:06
ok, i've had a quick look and the leak seems to have been caused by the hit testing stuff
@jkoritzinsky any idea what might be causing that?
AvaloniaUI/Avalonia@4fef640 in particular as far as i can see
Jeremy Koritzinsky
@jkoritzinsky
May 27 2016 12:36
Maybe since I don't cache the bounds geometry it keeps creating it and maybe there's a leak there? That was the only hit testing change.
danwalmsley
@danwalmsley
May 27 2016 12:49
I really hope this has flagged up one of the memory leaks iv been struggling with for ages :)
Andrey Kunchev
@donandren
May 27 2016 13:04
@jkoritzinsky @grokys I think i can fix the memory leak in hittesting and little bit simlify the hit testing to be used without geometry
I can submit PR if you want to see it
Steven Kirk
@grokys
May 27 2016 13:07
sure!
Andrey Kunchev
@donandren
May 27 2016 13:08
you'll have in the next 10 mites I've just tested locally
Andrey Kunchev
@donandren
May 27 2016 13:22
@grokys @jkoritzinsky submited the PR
Steven Kirk
@grokys
May 27 2016 13:23
that looks good to me i think - will wait from comments from @jkoritzinsky
and it fixes the leak?
Andrey Kunchev
@donandren
May 27 2016 13:23
yes
@grokys what about renaming TransformOrigin to RenderTransformOrigin and make it's default value TopLeft (0,0) like it's in wpf, so we can reuse in some extend some xaml files?
on IVisual and Visual
Steven Kirk
@grokys
May 27 2016 13:26
so we can reuse in some extend some xaml files
what do you mean by that?
you mean to improve compatibility with WPF?
Andrey Kunchev
@donandren
May 27 2016 13:28
if we rename it we can use some canvas, rectanlge,line,path xaml files just the main xmlns namespace to avalonia
yes it will have some compatibility with wpf
Steven Kirk
@grokys
May 27 2016 13:28
haha ok, i have no idea what you mean ;)
ooooh
no i understand
sorry
Andrey Kunchev
@donandren
May 27 2016 13:29
we can just copy and paste some graphics xaml files
Steven Kirk
@grokys
May 27 2016 13:29
yeah, i wouldn't be opposed to that - just as a default the top left seems less useful than the center as a transform origin
Andrey Kunchev
@donandren
May 27 2016 13:29
and replace xmlns="..microsoft..." with xmlns="...avaloniaui.."
Steven Kirk
@grokys
May 27 2016 13:29
yeah
Andrey Kunchev
@donandren
May 27 2016 13:29
and use it
Steven Kirk
@grokys
May 27 2016 13:30
:+1: for renaming it to have the same name
Andrey Kunchev
@donandren
May 27 2016 13:31
yes it's more useful the origin to be in the center, but in wpf is topleft . but that's not a big issue anyway
Steven Kirk
@grokys
May 27 2016 13:32
if you want to submit another PR with the property name change i'd be fine with that
Andrey Kunchev
@donandren
May 27 2016 13:33
I've made some demo apps with Avalonia to my bosses - they are impressed and we'll use it in application very soon :)
Steven Kirk
@grokys
May 27 2016 13:33
#549 got the :+1: from @jkoritzinsky - I will merge it this afternoon sometime after i've tried it
Andrey Kunchev
@donandren
May 27 2016 13:34
I'll submit PR with the rename when i have some free time
danwalmsley
@danwalmsley
May 27 2016 13:34
Awesome guys that's a great fix @donandren
Steven Kirk
@grokys
May 27 2016 13:34
@donandren cool! though slightly scary ;)
Steven Kirk
@grokys
May 27 2016 19:01
ok guys, applied to join the .NET foundation
danwalmsley
@danwalmsley
May 27 2016 19:03
oh wow! that would be an amazing step, so how do they decide if we get to join?
Steven Kirk
@grokys
May 27 2016 19:09
no idea!
but someone from there contacted me last year and asked if we'd be interested in joining, but we needed to do the name change first
danwalmsley
@danwalmsley
May 27 2016 19:11
sounds like its pretty likely to get accepted then
that would surely get us loads of contributions :)
Steven Kirk
@grokys
May 27 2016 19:13
:D lets hope i can keep up!
@jkoritzinsky and @donandren have submitted some really good PRs recently so hopefully they can help with reviewing etc
in fact they seem to know the code better than me these days ;)
danwalmsley
@danwalmsley
May 27 2016 19:21
I'm trying to finish of my popup offsets PR
but having problems getting it to scale the offset for mouse over!
Andrey Kunchev
@donandren
May 27 2016 19:40
thanks @grokys, it's easy to understand the code with such elegant design and implementation. Hope to have more time for more PR's
danwalmsley
@danwalmsley
May 27 2016 20:10
@donandren you seemed to find that memory leak quite easily, was that because you knew the code well, or because you have a special technique to finding leaks? I've been trying to track down a few leaks for a while now, iv fixed a few, but there is 1 in particular I just cant get to bottom of
Andrey Kunchev
@donandren
May 27 2016 20:14
@danwalmsley don't have special technique just my luck, experience and may be some knowledge of the code and 10 minutes looking into the code
danwalmsley
@danwalmsley
May 27 2016 20:19
do you mind having a look if I set up a repro for one leak?
@grokys iv found some kind of bug in popup... I think its unintended behaviour
popup.cs Open method
public void Open()
        {
            if (_popupRoot == null)
            {
                _popupRoot = new PopupRoot(DependencyResolver)
                {
                    [~ContentControl.ContentProperty] = this[~ChildProperty],
                    [~WidthProperty] = this[~WidthProperty],
                    [~HeightProperty] = this[~HeightProperty],
                    [~MinWidthProperty] = this[~MinWidthProperty],
                    [~MaxWidthProperty] = this[~MaxWidthProperty],
                    [~MinHeightProperty] = this[~MinHeightProperty],
                    [~MaxHeightProperty] = this[~MaxHeightProperty],
                };

                ((ISetLogicalParent)_popupRoot).SetParent(this);
            }

            _popupRoot.Position = GetPosition();

            if (_topLevel == null && PlacementTarget != null)
            {
                _topLevel = PlacementTarget.GetSelfAndLogicalAncestors().First(x => x is TopLevel) as TopLevel;
            }

            if (_topLevel != null)
            {
                _topLevel.Deactivated += TopLevelDeactivated;
                _topLevel.AddHandler(PointerPressedEvent, PointerPressedOutside, RoutingStrategies.Tunnel);
                _nonClientListener = InputManager.Instance.Process.Subscribe(ListenForNonClientClick);
            }

            PopupRootCreated?.Invoke(this, EventArgs.Empty);

            _popupRoot.Show();
            IsOpen = true;
            Opened?.Invoke(this, EventArgs.Empty);
        }
IsOpen = true...
/// <summary>
        /// Called when the <see cref="IsOpen"/> property changes.
        /// </summary>
        /// <param name="e">The event args.</param>
        private void IsOpenChanged(AvaloniaPropertyChangedEventArgs e)
        {
            if ((bool)e.NewValue)
            {
                Open();
            }
            else
            {
                Close();
            }
        }
that triggers IsOpenChanged (not sure where the subscription happens here)
Darnell Williams
@Seeker1437
May 27 2016 20:22
StackOverlfow?
danwalmsley
@danwalmsley
May 27 2016 20:22
and that calls Open (recursively)
well I'm not getting stack overflow
not sure why not
but I'm going to keep stepping again to see what happens next
looks like it should
but when it let it run, it doesnt
Darnell Williams
@Seeker1437
May 27 2016 20:23
maybe somewhere it's force closed
danwalmsley
@danwalmsley
May 27 2016 20:27
not sure, it calls recursively like 3 times
then jumps out
I don't get why it doesn't stack overflow
ok 2 times
same on close
hmm if I get popup to open at mouse cursor x,y + 10,10
then I immediately get
case UnmanagedMethods.WindowActivate.WA_INACTIVE:
                            _isActive = false;
                            Deactivated?.Invoke();
                            break;
and that causes it to close
any one can tell why?
danwalmsley
@danwalmsley
May 27 2016 20:41
ah I think its looking for clicks outside
which might cause that message
and if it opens with pointer outside popup, it gets that, so first 1 should be ignored perhaps
danwalmsley
@danwalmsley
May 27 2016 21:01
@donandren the leak you fixed earlier, when I did memory snapshots, both were equal, the number of objects hadn't changed, even though the memory had increased 100s of mb
how can that have been?
danwalmsley
@danwalmsley
May 27 2016 21:43
@grokys ok PR #547 is now ready for you acceptance :)
Steven Kirk
@grokys
May 27 2016 21:44
I'm drinking right now so not sure ;)
Will take a look tomorrow
Hangover permitting ;)
danwalmsley
@danwalmsley
May 27 2016 21:46
no problem :) enjoy!
Darnell Williams
@Seeker1437
May 27 2016 21:56
Breaking t
danwalmsley
@danwalmsley
May 27 2016 22:43
@grokys I know you are probably enjoying a nice cold glass of moretti, so you don't have to answer just now
but popup memory leak
iv been digging deep into popup code... looks like when my popup is removed from its logical tree all the references are kept in _nameScope, which are holding my controls from being GCed
should _nameScope be cleared out somehow when it is removed from Logical tree?
Darnell Williams
@Seeker1437
May 27 2016 22:57
Weird
Darnell Williams
@Seeker1437
May 27 2016 23:05
@danwalmsley yeah it's possible when the Popup is being created somewhere we do something to retain focus on the ITopLevel after the fact, when that happens WA_INACTIVE would be sent, telling the Popup that the value passed through is the handle of the TopLevel that was activated or null.