I’m using MBS overlay in a Windows 7 database project where I found a cool way to fade between data updates in a listbox and avoid any flicker.
Works great only for one thing. My app leaks memory badly now. Every update or refresh adds an extra 10MB of memory that my app is using (Windows Task Manager info) to the point where eventually my app crashes with an ‘Out Of Memory Error’.
If I disable the fading, no memory leak.
Does anyone else use OverlayMBS? Is there a workaround?
Cheers
Grant
Why workaround? If there is a bug, let’s fix it!
I just tried a few things and can’t get it to leak here.
are you sure you don’t accumulate objects in some container like dictionary or array?
Or maybe a cycle references?
[quote=174340:@Christian Schmitz]I just tried a few things and can’t get it to leak here.
are you sure you don’t accumulate objects in some container like dictionary or array?
Or maybe a cycle references?[/quote]
Christian, no. Definitely no leaks when I comment the code out so it doesn’t run. Already thought of that.
It may help to know that I’m still using an old MBS version upto 2013-08. 13.2 maybe? You may have already fixed it!!
Here’s my code, which is not much different from the example “Overlay Magician”.
[code] dim o As FadingInterfaceFx
o=New FadingInterfaceFx( Self.left, Self.top, self.width, self.Height, false )
o.MakeScreenshot
o.speed = 10
// Clear the list and display new data here
if o <> nil then
o.show // Show the overlay window and start fading effect
end if[/code]
Does the problem go away with newer plugin?
I haven’t tried the newer plugins because I don’t have a license for it, but of course I understand it will still run in the IDE. I will try it now.
Cheers
Grant
Christian,
The problem is still there with plugins version 15.0, but is more pronounced gobbling up 45MB of memory per usage on my 64 bit development machine. The users PCs are 32 bit.
Cheers
Grant
Christian,
I’ve sent you an email with a video attachment. Please keep this video confidential.
Cheers
Grant
If this is still in current plugins, I would want to fix it.
But I don’t see it here, so I can only presume it’s fixed already.
Christian,
You were right originally, it was a circular object reference in your example project “OverlayMagician”.
In the FadingInterfaceEx
object, there’s a property which keeps a reference to the FadingInterfaceTimer
object. In the FadingInterfaceTimer
object, there’s a property which keeps a reference to the FadingInterfaceEx
object.
When the effect is complete, the original FadingInterfaceEx
object is not destroyed.
Changing the following code in the action
event of the FadingInterfaceTimer
object solves the problem:
if Duration > 0.0 then
win.Alpha = Duration
win.Update
Duration = Duration - StepAmount
else
Mode = 0
Win = nil //<-new code
'Win.Hide // <-old code
end if
You may want to update your example project.
Do I get a medal?
Cheers
Grant