These are chat archives for AvaloniaUI/Avalonia

1st
Jun 2016
Steven Kirk
@grokys
Jun 01 2016 08:39
hey @danwalmsley - how's the virtualizing going?
danwalmsley
@danwalmsley
Jun 01 2016 08:59
hey dude, i'll be back on it later on
I think I just need to know how to remove on item from the panel,, I kept removing one but then getting an exception, Container is already created
danwalmsley
@danwalmsley
Jun 01 2016 09:06
@grokys theres a new memory leak introduced in latest build
if you move or resize the window (I think its every render loop) memory usage goes up extremely quickly again
Steven Kirk
@grokys
Jun 01 2016 09:08
this is on master?
danwalmsley
@danwalmsley
Jun 01 2016 09:08
yes
when I run on Windows 7
its even more dramatic
Steven Kirk
@grokys
Jun 01 2016 09:09
ok, will take a look sometime later
btw did you manage to take a look at this PR? AvaloniaUI/Avalonia#553
danwalmsley
@danwalmsley
Jun 01 2016 09:09
ok thanks I'm going to see if the test app does same, basically I'm seeing anything change in the app, visually, adds about 10mb
@grokys I will try and squeeze that in today
danwalmsley
@danwalmsley
Jun 01 2016 09:16
test app does it but a lot less noticeable
perhaps not as many controls
Matthijs ter Woord
@mterwoord
Jun 01 2016 09:17
maybe you guys should invest some time in (basic) ui testing support (ui automation) then you can make automated tests for all kinds of stuff, including memoryu
danwalmsley
@danwalmsley
Jun 01 2016 09:20
@grokys Windows 7 the leak is way worse
its barely noticeable on Windows 10
it shouldn't be majorly different windows 7 vs windows 10?
Matthijs ter Woord
@mterwoord
Jun 01 2016 09:21
is it leaking managed or unmanaged ram?
danwalmsley
@danwalmsley
Jun 01 2016 09:21
unmanaged I suspect
Matthijs ter Woord
@mterwoord
Jun 01 2016 09:21
unmanaged is in drivers/pinvoke stuff, so that could be significantly different between OS-es
even on same os it could be due to driver stuff
iirc
danwalmsley
@danwalmsley
Jun 01 2016 09:23
true
Matthijs ter Woord
@mterwoord
Jun 01 2016 09:23
i'd (initially) focus on managed memory leaks
danwalmsley
@danwalmsley
Jun 01 2016 09:24
yeh this is a pretty major one recently introduced
mem usage on win 7 goes up to 2GB in only a few minutes
then crashes
I'm rolling back package to see what it runs with
Matthijs ter Woord
@mterwoord
Jun 01 2016 09:25
well, just set the process to be a 64-bit process and it should continue to run.. :)
danwalmsley
@danwalmsley
Jun 01 2016 09:25
for a few minuetes more :)
Matthijs ter Woord
@mterwoord
Jun 01 2016 09:25
yep
i'd really invest time into automated ui testing support if i were active on avalonia: that's the best thing happening to cosmos, imo...
Steven Kirk
@grokys
Jun 01 2016 09:33
@mterwoord yes it would be nice, but we really need to get basic functionality working first imo
but it all depends on who's willing to give their time
as the saying goes: "pull requests welcome!"
;)
Matthijs ter Woord
@mterwoord
Jun 01 2016 09:34
with cosmos, we only now (almost) have the first real thing working (FAT) but we worked on automated testing last year, to prevent reintroducing the same issues
danwalmsley
@danwalmsley
Jun 01 2016 09:46
@grokys If I roll back to build 1549 then the bug mem leak has gone away
prob don't need to go quite as far as that
danwalmsley
@danwalmsley
Jun 01 2016 09:51
actually even rolling back
when I go onto this Windows 7 machine
its still a dramatic memory leak
i'll do some memory snap shots see if I can see what it is
danwalmsley
@danwalmsley
Jun 01 2016 10:29
@grokys did memory snapshots and there were not really any changes, but the ram on this particular Windows 7 machine goes up 100s mb every second
just dragging around the window
I will try on another win 7 machine and see if the same happens
so I think it wasn't introduced recently and may have been there a long time
or we have a leak on all platforms, but its a slow leak, and on this machine that leak is much larger because of driver / hardware differences
does anyone have a Win 7 machine to see if the see the same thing?
Steven Kirk
@grokys
Jun 01 2016 10:34
sorry, no i don't have win7 on anything atm - it doesn't happen on 8 or 10?
danwalmsley
@danwalmsley
Jun 01 2016 10:39
ok I tried on another Win 7 machine and its ok
so its specific to 1 machine
all of the machines have a leak
but the rate at which the leak happens differs
Matthijs ter Woord
@mterwoord
Jun 01 2016 10:40
you're talking unmanaged or managed now?
danwalmsley
@danwalmsley
Jun 01 2016 10:40
so on my Win10 machine you see memory disappearing but its like 1/2 mb a minute, if your triggering renders
if your looking at the bad Win 7 machine
its 50mb per second
I'm pretty sure its unmanaged
probably a managed object that didn't dispose the managed part
Matthijs ter Woord
@mterwoord
Jun 01 2016 10:41
yeah
all idisposables i implement which really need disposing, i have a finalizer with a message telling it was missed...
danwalmsley
@danwalmsley
Jun 01 2016 10:42
so I would bet its the same leak
on all machines
Steven Kirk
@grokys
Jun 01 2016 10:45
if it's a managed object not disposing the managed part i'd expect to see the leak on all OSs
Matthijs ter Woord
@mterwoord
Jun 01 2016 10:45
you said you see the leak everywhere but the severity differs
Steven Kirk
@grokys
Jun 01 2016 10:45
could be a driver problem, perhaps?
Matthijs ter Woord
@mterwoord
Jun 01 2016 10:45
yeah
that's what i was about to say
:)
especially graphics i would assume that
assume -> at least consider it likely
Steven Kirk
@grokys
Jun 01 2016 10:46
could really do with testing on another machine with win7 i guess
Matthijs ter Woord
@mterwoord
Jun 01 2016 10:47
If you want I can make a vm and give you access?
Steven Kirk
@grokys
Jun 01 2016 10:47
no it's ok, i can do that
just a matter of time
Matthijs ter Woord
@mterwoord
Jun 01 2016 10:48
have a (near) clean win 8 machine
Steven Kirk
@grokys
Jun 01 2016 10:48
if you wanted to try to repro the leak yourself however, that would be great!
Matthijs ter Woord
@mterwoord
Jun 01 2016 10:48
i'm currently at work, but besiees that have lots of stuff to do for my own busines.... (including preparing for vacation)
danwalmsley
@danwalmsley
Jun 01 2016 11:10
@grokys I do see the leak on all machines
its just for what ever reason perhaps the graphics on the other machine is poor
and what takes up 200kb on the others
takes up 20mb on this other one
Matthijs ter Woord
@mterwoord
Jun 01 2016 11:11
what graphics driver you have installed there?
danwalmsley
@danwalmsley
Jun 01 2016 11:11
i'll check
its difficult because its a colleagues machine
hang on
danwalmsley
@danwalmsley
Jun 01 2016 11:29
unspecified.png
that's the bad machine
all I do is run an Avalonia program and drag the screen around and resize a bit
after less than a minute that's the mem usage
Matthijs ter Woord
@mterwoord
Jun 01 2016 11:30
hmm, thats purely unmanaged memory then....
danwalmsley
@danwalmsley
Jun 01 2016 11:30
and no managed objects are left over between snapshots
Matthijs ter Woord
@mterwoord
Jun 01 2016 11:30
you have dotmemory?
danwalmsley
@danwalmsley
Jun 01 2016 11:30
but I can show you same on Win 10, but the graph doesn't go up quite as steeply.
yeh
but can that show unmanaged?
Matthijs ter Woord
@mterwoord
Jun 01 2016 11:31
doubt it, but it can show you which managed objects got created (and also recollected) between snapshots
maybe that'll give you a way to track down the issue?
danwalmsley
@danwalmsley
Jun 01 2016 11:31
yeh i'll have a look
Matthijs ter Woord
@mterwoord
Jun 01 2016 11:32
I'd advice to make all your idisposables (which reference unmanged ram) print a message to the debug window to show that tey didn't get disposed of properly
danwalmsley
@danwalmsley
Jun 01 2016 11:40
ok I'll try and get a list of objects that are created and disposed between those snapshots
Matthijs ter Woord
@mterwoord
Jun 01 2016 11:40
well, aren't you expecting objects arent exposed?
danwalmsley
@danwalmsley
Jun 01 2016 11:41
?
not sure I understand?
Matthijs ter Woord
@mterwoord
Jun 01 2016 11:41
weren't you expecting that objects dont get disposed of correctly?
disposed != reclaimed
danwalmsley
@danwalmsley
Jun 01 2016 11:42
yes
Matthijs ter Woord
@mterwoord
Jun 01 2016 11:42
ok, so you mean you'll look at reclaimed objects, not the disposed ones
danwalmsley
@danwalmsley
Jun 01 2016 12:03
sorry yes, objects that have been garbage collected right?
Matthijs ter Woord
@mterwoord
Jun 01 2016 12:13
yeah
Steven Kirk
@grokys
Jun 01 2016 12:48
if we're talking unmanaged memory from the graphics subsystem, SharpDX already has disposal tracking
Matthijs ter Woord
@mterwoord
Jun 01 2016 12:53
i'd say turn that on and see what happens..
danwalmsley
@danwalmsley
Jun 01 2016 13:04
just having a look now :)
danwalmsley
@danwalmsley
Jun 01 2016 13:10
ok this is the output at various points with memory leaking.
quite a long log. but the more eyes on it the better
Matthijs ter Woord
@mterwoord
Jun 01 2016 13:10
that looks to me like a hell of a good starting point int racing you leakage..
danwalmsley
@danwalmsley
Jun 01 2016 13:12
looks like its not sharpdx from those logs?
there are several MBs lost
but number of objects doesn't seem to be increasing?
Matthijs ter Woord
@mterwoord
Jun 01 2016 13:13
if i interpret things correctly, those numbers of objects are being reclaimed, and it then says it wasnt disposed?
danwalmsley
@danwalmsley
Jun 01 2016 13:14
I called ReportActiveObjects
Matthijs ter Woord
@mterwoord
Jun 01 2016 13:14
ah
danwalmsley
@danwalmsley
Jun 01 2016 13:14
so that's things not being reclaimed
Matthijs ter Woord
@mterwoord
Jun 01 2016 13:15
have you just ran with enabling that property thing?
danwalmsley
@danwalmsley
Jun 01 2016 13:15
the numbers go up then down again
yes,
you have to enable then call ReportActiveObjects
it doesn't trace to output without calling report active objects
Matthijs ter Woord
@mterwoord
Jun 01 2016 13:16
ah ok, then that's something diferent than i usually do..
danwalmsley
@danwalmsley
Jun 01 2016 13:20
if its not sharpdx what else could it be on Win32?
@grokys
Matthijs ter Woord
@mterwoord
Jun 01 2016 13:21
any weird stuff installed like vnc mirroring driver etc?
danwalmsley
@danwalmsley
Jun 01 2016 13:28
no
this is happening on all platforms
even if you run avalonia on your machine
this leak is happening
but no one is noticing it
because most of the time its small
hmm if sharpdx is com could it be a bug in some old com assembly its relying on?
Matthijs ter Woord
@mterwoord
Jun 01 2016 13:31
:)
danwalmsley
@danwalmsley
Jun 01 2016 13:32
i'll get a log from the affected machine, see if its any different
Steven Kirk
@grokys
Jun 01 2016 13:34
try setting EnableReleaseOnFinalizer and see if it goes away
and EnableTrackingReleaseOnFinalizer
Matthijs ter Woord
@mterwoord
Jun 01 2016 13:35
i'd say the latter should allow tracing the issue?
danwalmsley
@danwalmsley
Jun 01 2016 13:37
hmmm enableReleaseOnFinalizer looks like it fixes the issue
let me try on the Win7 machine.
Matthijs ter Woord
@mterwoord
Jun 01 2016 13:38
i'd say ideally you should be doing .dispose yourself?
danwalmsley
@danwalmsley
Jun 01 2016 13:38
oh yeh
but this narrows it down a little.
Matthijs ter Woord
@mterwoord
Jun 01 2016 13:38
i mean, it's goot to narrow dow
:)
danwalmsley
@danwalmsley
Jun 01 2016 13:38
This message was deleted
This message was deleted
something is increasing I think
Steven Kirk
@grokys
Jun 01 2016 13:40
it should be writing the objects that weren't disposed to the output window if you've enabled EnableTrackingReleaseOnFinalizer
Matthijs ter Woord
@mterwoord
Jun 01 2016 13:41
@grokys Yeah, that's the thing i meant all the time.. :)
danwalmsley
@danwalmsley
Jun 01 2016 13:42
yeh those pastes are all the active items
Steven Kirk
@grokys
Jun 01 2016 13:43
it's not the active items we're interested in - it's the ones that aren't getting disposed
Matthijs ter Woord
@mterwoord
Jun 01 2016 13:43
the ones that leak away :)
Steven Kirk
@grokys
Jun 01 2016 13:43
yeah - the ones in that trace are just the ones that share the lifetime of the application
well most of them - but it's impossible to see which are leaking and which aren't
danwalmsley
@danwalmsley
Jun 01 2016 13:45
ok right I can confirm those settings fix the problem on the Windows 7 machine
Steven Kirk
@grokys
Jun 01 2016 13:45
ok good
Matthijs ter Woord
@mterwoord
Jun 01 2016 13:45
so it's a matter of correctly disposing stuff somewhere
danwalmsley
@danwalmsley
Jun 01 2016 13:45
so I will use that as a temporary work around... now we know where we have to look
Steven Kirk
@grokys
Jun 01 2016 13:45
so what is getting disposed on finalizer?
danwalmsley
@danwalmsley
Jun 01 2016 13:46
is there a way to check?
Steven Kirk
@grokys
Jun 01 2016 13:46
what is the output from EnableTrackingReleaseOnFinalizer?
haha YES
danwalmsley
@danwalmsley
Jun 01 2016 13:46
ah i'll have a look
how do you see sytem.diagnostics trace?
Matthijs ter Woord
@mterwoord
Jun 01 2016 13:47
debugger output panel?
danwalmsley
@danwalmsley
Jun 01 2016 13:47
oh right
Matthijs ter Woord
@mterwoord
Jun 01 2016 13:47
or otherwise you can add textwriters to it so it dumps to disk
Steven Kirk
@grokys
Jun 01 2016 13:48
i hate saying RTFM, but...
danwalmsley
@danwalmsley
Jun 01 2016 13:48
I don't see anything on console output
Matthijs ter Woord
@mterwoord
Jun 01 2016 13:48
debug != console
danwalmsley
@danwalmsley
Jun 01 2016 13:48
debug console in Visual Studio
Matthijs ter Woord
@mterwoord
Jun 01 2016 13:48
ah :)
danwalmsley
@danwalmsley
Jun 01 2016 13:49
nope nothing
hmm wierd
Steven Kirk
@grokys
Jun 01 2016 13:49
oh, ok, strange
danwalmsley
@danwalmsley
Jun 01 2016 13:50
ok maybe its just on win 7 one that it does that
2 secs
Matthijs ter Woord
@mterwoord
Jun 01 2016 13:50
it prints on win7 only, or?
ah looks like you have to set EnableReleaseOnFinalizer = false
danwalmsley
@danwalmsley
Jun 01 2016 13:51
ah that will be why
Steven Kirk
@grokys
Jun 01 2016 13:51
with EnableTrackingReleaseOnFinalizer = true
danwalmsley
@danwalmsley
Jun 01 2016 13:52
this mem leak has been buggin me for ages
not seeing anything in console
but changing that brings bug back
Steven Kirk
@grokys
Jun 01 2016 13:54
:(
weird
unless writing to the output window is somehow not working i can't see what's going wrong
danwalmsley
@danwalmsley
Jun 01 2016 13:59
is it not that you need to enable diagnostics to be output?
but yeh just checked on the Win7 machine no log messages
but that change fixes the bug
Trace.Listeners.Add(new TextWriterTraceListener(Console.Out));
       Trace.AutoFlush = true;
       Trace.Indent();
       Trace.WriteLine("Entering Main");
       Console.WriteLine("Hello World.");
       Trace.WriteLine("Exiting Main"); 
       Trace.Unindent();
have to add a trace listener?
System.Diagnostics.Debug.WriteLine - that always writes to the output window for me - i use it all the time
danwalmsley
@danwalmsley
Jun 01 2016 14:03
I manually did Trace.WriteLine
and it output
ok so maybe they have a bug in sharpdx?
Steven Kirk
@grokys
Jun 01 2016 14:04
i really have no idea...
danwalmsley
@danwalmsley
Jun 01 2016 14:04
for now I will have to enable that as a work around
Steven Kirk
@grokys
Jun 01 2016 14:05
i can't think of how to proceed without recompiling sharpdx!
danwalmsley
@danwalmsley
Jun 01 2016 14:06
id say
use that as a work around for now
bearing in mind we should have skia working soon?
Steven Kirk
@grokys
Jun 01 2016 14:08
i don't really want to put that workaround in master
we need to find out what's leaking
feel free to put it in your app code though, obv
Steven Kirk
@grokys
Jun 01 2016 14:16
so were you able to make it happen on other versions of windows? could you file an issue so i can repro later?
danwalmsley
@danwalmsley
Jun 01 2016 15:08
I think the same leak is happening on all windows versions
just for some reason this pc its extra bad
but the same fix stopped the leak on 2 Win7 machines and my Win 10 machine
Matthijs ter Woord
@mterwoord
Jun 01 2016 15:09
might be gfx driver specific issue (size of the leak)
danwalmsley
@danwalmsley
Jun 01 2016 15:11
yeh
I'm going to get them to update gfx driver
but on that machine
there are other issues
Matthijs ter Woord
@mterwoord
Jun 01 2016 15:12
other "scary" issues?
danwalmsley
@danwalmsley
Jun 01 2016 15:12
if you drag the main window and resize a bit
then open a popup
you loose all control of main window
so if a mainmenu opens
so theres definitely some weird issue
Matthijs ter Woord
@mterwoord
Jun 01 2016 15:12
sounds like a smelly gfx driver
Steven Kirk
@grokys
Jun 01 2016 15:14
so what exactly is the repro?
danwalmsley
@danwalmsley
Jun 01 2016 15:15
open task manager
run test app
look at the ram (the visual studio memory viewer you will barely see change, or will tak e a long time)
drag window around
and resize window
lots
you will see memory gradually creeping up
some machines more than others
do you get that happen on your machine?
Steven Kirk
@grokys
Jun 01 2016 15:19
dragging window around, no, but resizing yes
danwalmsley
@danwalmsley
Jun 01 2016 15:20
ok maybe dragging window was a red herring
but resizing definitely does it
and do you see if you put the workaround in for sharpdx the problem go away?
Steven Kirk
@grokys
Jun 01 2016 15:22
ok yeah i see it
it seems that the default for EnableTrackingReleaseOnFinalizer is true
so we should've been seeing the warnings all along
but... no warnings
danwalmsley
@danwalmsley
Jun 01 2016 15:27
perhaps we need to mod the sharpdx code to track it down
:(
Steven Kirk
@grokys
Jun 01 2016 15:33
what branch are you doing this on? master?
because i can't repro it there now
i was on the virtualization branch and it was happening, but on master it doesn't seem to be
danwalmsley
@danwalmsley
Jun 01 2016 15:55
yeh master
iv been reproing on nugget packages
Steven Kirk
@grokys
Jun 01 2016 16:07
ok here's the thing: i can repro in the virtualization branch but only on the virtualization tab - if i select the buttons tab the mem usage stays rock-solid
danwalmsley
@danwalmsley
Jun 01 2016 16:07
with Avalon studio it shows up on nugget packages easily
what happens if you remove the virtualization tab
just comment out the xaml
and load it does it go away
you didn't leave the work around in by accident?
Steven Kirk
@grokys
Jun 01 2016 16:09
yep, stays solid at 25.1mb
my repository is clean, no changes
danwalmsley
@danwalmsley
Jun 01 2016 16:17
hmmm
danwalmsley
@danwalmsley
Jun 01 2016 16:52
maybe the leak is in a certain control?
that is not present on master XAML test tool?
danwalmsley
@danwalmsley
Jun 01 2016 17:02
@grokys could be to do with
note about DirectX requiring stuff to be disposed in correct order
so we dispose but not in correct order
Steven Kirk
@grokys
Jun 01 2016 17:28
could be i guess... why am i not getting the leak though?
danwalmsley
@danwalmsley
Jun 01 2016 18:19
AvalonStudio shows it
and I was getting it on test app too
so im not sure
let me try xaml test app again here
danwalmsley
@danwalmsley
Jun 01 2016 18:27
do you know why virtualization branch shows it?
hmmm yeh test tool on my laptop doesn't show it
danwalmsley
@danwalmsley
Jun 01 2016 18:38
this is wierd
what about control catalog?
I cant get it to build on mine, missing gtk / cairo reference
do they build on windows?
Steven Kirk
@grokys
Jun 01 2016 19:10
test tool on my laptop doesn't show it
test tool?
to build control catalog you need to install gtk# - see the build instructions
danwalmsley
@danwalmsley
Jun 01 2016 19:20
Xaml test app
Sorry
When it happens on virtualization
Does setting sharpdx collect
On finalize fix it?
Steven Kirk
@grokys
Jun 01 2016 19:32
are you writing in haiku? ;)
yeah, it seemed to fix it, weird
must be some sort of side effect?
danwalmsley
@danwalmsley
Jun 01 2016 19:49
Hmmm odd, yeah im all over the place today mate
Steven Kirk
@grokys
Jun 01 2016 20:01
:) i know the feeling
danwalmsley
@danwalmsley
Jun 01 2016 20:02
i'll get back to virtualization before I goto bed
just need a hint
on....
Line 95
there I just need to get rid of the last item in the list
so far iv calculated the correct index now
but I'm not sure how to properly delete the last item
when I removed it last time, the next re-render it complained a container already existed for that item
Steven Kirk
@grokys
Jun 01 2016 20:22
you need to delete it from the panel, and dematerialize it from the ItemContainerGenerator
danwalmsley
@danwalmsley
Jun 01 2016 20:23
cheers, that sounds like what I was after
ok i'll try and do a bit more on that :)
Steven Kirk
@grokys
Jun 01 2016 20:24
i will probably have tomorrow free (it's a holiday here) so i can probably take off from where you get to if you like
danwalmsley
@danwalmsley
Jun 01 2016 20:50
ok sure, well what ever I get done I'll push
prob wont be much hopefully at least resolving that last test case I added
maybe another couple of tests
Steven Kirk
@grokys
Jun 01 2016 20:57
that'd be great!
danwalmsley
@danwalmsley
Jun 01 2016 22:25
@grokys ok iv pushed an initial implementation to the WIP PR
#554
and added some more test cases, at least one of them is currently failing.
hopefully they are useful to you
right I think that all you will be able to get out of me tonight
take care buddy