NextPVR Forums
  • ______
  • Home
  • New Posts
  • Wiki
  • Members
  • Help
  • Search
  • Register
  • Login
  • Home
  • Wiki
  • Members
  • Help
  • Search
NextPVR Forums Public Developers v
« Previous 1 … 20 21 22 23 24 … 93 Next »
WizTools - 1.x Plugin Development Toolkit

 
  • 0 Vote(s) - 0 Average
WizTools - 1.x Plugin Development Toolkit
JavaWiz
Offline

Posting Freak

Jacksonville, FL. USA
Posts: 2,522
Threads: 141
Joined: Dec 2006
#301
2009-12-16, 03:27 AM
Great, glad you got it all sorted out.
Ommina
Offline

Senior Member

Posts: 330
Threads: 39
Joined: Feb 2006
#302
2010-02-10, 07:25 AM (This post was last modified: 2010-02-10, 01:15 PM by Ommina.)
I'm back!

I need to return to the subject of disposing popup resources, because I must be doing something wrong.

I've been attaching perfmon to PVRX2 to see how things in memory are behaving. Managed memory seems pretty stable, but private bytes are just doing silly things. Both private and virtual bytes are increasing (the amount of which they increase varies with the complexity of the popup, the more complex the popup, the more the memory is consumed).

In turn, they never recover, with each new popup taking a fresh chunk of memory.

I originally just wrote this off as .NET not bothering to give memory back until some other process asked, but over time, system performance deteriorates. You can hear it paging as the main menu scrolls.

Eventually, it reaches the point where it can no longer create new resources at all. Popups come out blank, even the main menu will no longer display. PVRX2 must then be shut down via alt-F4. At this point, private bytes are over 1GB. (Which, on a machine that only has 1GB of ram in the first place, is a fair chunk of memory for one process.)

Sure, a newer machine with 4GB would do better, but I think it would just postpone the inevitable.

Popup code is pretty much as you listed.

The popup itself is a base class (implements IUiTask, Inherits Popups.PopupBase) which holds WizControlManager, a couple of strings (popup name, skinsubdirectory) and has needsRendering.

The popup proper inherits from this, and implements IUiPopup.

Do I need to be implementing my own Dispose() after all? (Going to do some experimenting with this now.)

Or... doing something... else?

Any guesses / suggestions?

Edit:

Followup. A .dispose on ControlManager did wonders, although a less aggressive increase in private bytes remains. Tomorrow's task is to create a popup with no controls whatsoever, and see what happens with that. Suggestions remain welcome!
JavaWiz
Offline

Posting Freak

Jacksonville, FL. USA
Posts: 2,522
Threads: 141
Joined: Dec 2006
#303
2010-02-11, 04:57 AM
My popup forms implement PopupBase and IUiPopup as follows:

Code:
[SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]public[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]class[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#2b91af][SIZE=2][COLOR=#2b91af]MovieInfoPopup[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] : [/SIZE][SIZE=2][COLOR=#2b91af][SIZE=2][COLOR=#2b91af]PopupBase[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2], [/SIZE][SIZE=2][COLOR=#2b91af][SIZE=2][COLOR=#2b91af]IUiPopup[/COLOR][/SIZE]
[/COLOR][/SIZE][SIZE=2]{[/SIZE]
[SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]public[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] MovieInfoPopup([/SIZE][SIZE=2][COLOR=#2b91af][SIZE=2][COLOR=#2b91af]IUiPopupCallback[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] popupCallback, [/SIZE][SIZE=2][COLOR=#2b91af][SIZE=2][COLOR=#2b91af]MovieWizCore[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] core, [/SIZE][SIZE=2][COLOR=#2b91af][SIZE=2][COLOR=#2b91af]MovieEntry[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] movieEntry, [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]bool[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] externalPlayerAvailable, [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]string[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] SkinSubDirectory)[/SIZE]
[SIZE=2]: [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]base[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2](popupCallback)[/SIZE]
[SIZE=2]{[/SIZE]
[SIZE=2]LogMessage([/SIZE][SIZE=2][COLOR=#a31515][SIZE=2][COLOR=#a31515]"Constructor"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2], [/SIZE][SIZE=2][COLOR=#a31515][SIZE=2][COLOR=#a31515]"called"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]);[/SIZE]
[SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]this[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].core = core;[/SIZE]
[SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]this[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].movieEntry = movieEntry;[/SIZE]
[SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]this[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].externalPlayerAvailable = externalPlayerAvailable;[/SIZE]
[SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]this[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].skinSubDirectory = SkinSubDirectory;[/SIZE]
[SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]this[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].activating = [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]true[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2];[/SIZE]
[SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]this[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].animationStartTime = [/SIZE][SIZE=2][COLOR=#2b91af][SIZE=2][COLOR=#2b91af]SkinHelper2[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].GetAnimationTime();[/SIZE]
[SIZE=2]}[/SIZE]
[SIZE=2]My dispose method looks like:[/SIZE]

Code:
public override void Dispose()
{
LogMessage("Dispose()", "ENTER");
base.Dispose();
ctlMgr.Dispose();
skinHelper2.DisposeResources();
LogMessage("Dispose()", "EXIT");
}
[SIZE=2]
[SIZE=2]In the main program I treat this like any other popup:

[/SIZE]
[/SIZE]
Code:
setPopup(new MovieInfoPopup(this, core, me, false, mSkinDirectory));

and like any other popup, when done:
setPopup(null);

Code:
[SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]private[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]void[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] setPopup([/SIZE][SIZE=2][COLOR=#2b91af][SIZE=2][COLOR=#2b91af]IMenuTask[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] popup)[/SIZE]
[SIZE=2]{[/SIZE]
[SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]if[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] (([/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]this[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].activePopup != popup) && ([/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]this[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].activePopup [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]is[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#2b91af][SIZE=2][COLOR=#2b91af]IUiPopup[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]))[/SIZE]
[SIZE=2]{[/SIZE]
[SIZE=2](([/SIZE][SIZE=2][COLOR=#2b91af][SIZE=2][COLOR=#2b91af]IUiPopup[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2])[/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]this[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].activePopup).Dispose();[/SIZE]
[SIZE=2]}[/SIZE]
[SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]if[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] (mbInsetRectangleSet)[/SIZE]
[SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]if[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] (popup != [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]null[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] && isPlayingVideo())[/SIZE]
[SIZE=2]{[/SIZE]
[SIZE=2]txtVideoThumbnail.Visible = [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]true[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2];[/SIZE]
[SIZE=2][COLOR=#2b91af][SIZE=2][COLOR=#2b91af]PluginHelperFactory[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].getPluginHelper().HideInset();[/SIZE]
[SIZE=2]}[/SIZE]
[SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]else[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]if[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] (isPlayingVideo())[/SIZE]
[SIZE=2]{[/SIZE]
[SIZE=2]txtVideoThumbnail.Visible = [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]false[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2];[/SIZE]
[SIZE=2][COLOR=#2b91af][SIZE=2][COLOR=#2b91af]PluginHelperFactory[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].getPluginHelper().ShowInsetAtLocation(mInsetRectangle);[/SIZE]
[SIZE=2]}[/SIZE]
[SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]this[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].activePopup = popup;[/SIZE]
[SIZE=2]mMoreRenderingRequired = [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]true[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2];[/SIZE]
[SIZE=2]}[/SIZE]
Ommina
Offline

Senior Member

Posts: 330
Threads: 39
Joined: Feb 2006
#304
2010-02-11, 08:09 AM
Thanks for the reply. That's pretty much what I have now, which is both encouraging and discouraging at the same time.

Over the last hour, I've done some more playing.

First, I created a blank popup. No WizUiTools controls, or, for that matter, any other controls. Just a blank. No disposable resources.

Code:
#If DEBUG Then

Imports GBPVRX2

Public Class PopupTest
    Inherits Popups.PopupBase
    Implements IUiTask, IUiPopup

    Private _SkinSubDirectory As String
    Private _PopupName As String

    Public Sub New(ByVal PopupCallback As IUiPopupCallback, ByVal SkinSubDirectory As String, ByVal PopupName As String)
        MyBase.New(PopupCallback)

        _SkinSubDirectory = SkinSubDirectory
        _PopupName = PopupName

        Debug.WriteLine("PopupTest_New")

    End Sub
    Protected Overrides Function getSkinFileName() As String

        Dim s As String = _SkinSubDirectory + "\" + _PopupName + ".xml"

        Debug.WriteLine("PopupText_getSkinFileName: " + s)

        Return s

    End Function
    Public Overrides Sub Dispose() Implements GBPVRX2.IUiPopup.Dispose

        Debug.WriteLine("PopupTest_Dispose")

        skinHelper2.DisposeResources()

        MyBase.Dispose()

    End Sub
    Public Overrides Function OnKeyDown(ByVal e As System.Windows.Forms.KeyEventArgs) As Boolean

        Debug.WriteLine("PopupTest_OnKeyDown")

        closeWithCommand("foo")

        Return True

    End Function

End Class

#End If

Result: private bytes continue to grow. Not as sharply as before, but steady growth regardless. (Exception: it will drop somewhat when the GC runs, but the overall trend is upward.)

Next test, leaving the plugin world. Using the "Settings|Skin" popup as a test, I went through the same motions. Result this time, private bytes continued to rise, quite quickly actually.

In all cases, managed memory is steady. If I'm understanding things correctly, then, it is unmanaged resources that are wandering off.

Tonight's adventures leave me suspecting that I've moved outside the realm of the WizUi toolset, and that it might be time to poke at sub instead. (While happily acknowledging that I might be making errors in interpretation. This is a new area for me.)
McBainUK
Offline

Posting Freak

Posts: 4,711
Threads: 429
Joined: Sep 2005
#305
2010-03-17, 01:16 PM
JavaWiz: Can the WizInfo log features be used from outside a GB-PVR process?
Wiki profile
My Projects
Programs Plugin [SIZE=2](retired)
| Volume OSD Plugin (retired) | Documentation Wiki (retired)
[/SIZE]
JavaWiz
Offline

Posting Freak

Jacksonville, FL. USA
Posts: 2,522
Threads: 141
Joined: Dec 2006
#306
2010-03-18, 12:46 AM
McBainUK Wrote:JavaWiz: Can the WizInfo log features be used from outside a GB-PVR process?
Not exactly. Use the WLog functions in WizGenHelper instead, less dependencies on all the other DLLs...
Ommina
Offline

Senior Member

Posts: 330
Threads: 39
Joined: Feb 2006
#307
2010-03-18, 08:22 AM
JavaWiz:

Using the latest developer zip from the wiki (although I note it has an earlier date than the compiled DLLs), I'm getting an Index Out of Range exception when trying to do a setListItem(Index, Item) on the last item of a list. (Yes, I'm quite confident that the index is correct!)

I also understand that you're not exclusively maintaining the controls anymore. Is this something that I should be looking into fixing myself?
JavaWiz
Offline

Posting Freak

Jacksonville, FL. USA
Posts: 2,522
Threads: 141
Joined: Dec 2006
#308
2010-03-27, 06:11 PM
Actually, I (think) I still have the most current version of the code. Could you paste a snippet of the code that causes the problem, I'll take a look. I'm on the road right now, will not be able to troubleshoot for a couple weeks...
Ommina
Offline

Senior Member

Posts: 330
Threads: 39
Joined: Feb 2006
#309
2010-03-27, 09:55 PM
Ok! Snippet incoming!

Short version --

Code:
WizUiList.setListItem(WizUiList.count() - 1, new WizListItem() );

I'm adding a 'seen' icon to a list item with the associated file is, er, seen. So some actual code, extra bits removed. Get the currently selected item and it's index. Make a change to said item. Place it back into list using the index from earlier. Which works great, except for the very last item in the list, which gives an "Index out of Range".

Code:
WizUiList.WizListItem lstItem = (WizUiList.WizListItem) lstFiles.getCurrentItem();
Int32 nCurrentIndex = lstFiles.getCurrentItemIndex();
' Make a handful of changes to lstItem
lstFiles.setListItem(nCurrentIndex, lstItem);

As I poke at it now, I can probably work around the problem by using getSelectedItem() repeatedly, instead of creating a local reference. But since I do a fair amount of fussing with the list item, it's sharply more convenient not to have to do all that casting about.

Hope your trip is going well - thank you for taking a look at it when you're able!
« Next Oldest | Next Newest »

Users browsing this thread: 1 Guest(s)

Pages (31): « Previous 1 … 27 28 29 30 31
Jump to page 


Possibly Related Threads…
Thread Author Replies Views Last Post
  PIP plugin for Kodi sgilani 2 3,024 2022-10-17, 12:44 AM
Last Post: sgilani
  New Systems Plugin kirschey 10 3,512 2020-11-14, 08:01 PM
Last Post: sub
  Test/Development environment for npvr.db3 scJohn 10 4,509 2020-09-04, 09:14 PM
Last Post: scJohn
  VIdeo playback from plugin mvallevand 5 3,605 2015-08-06, 10:43 PM
Last Post: sub
  Attention Sub: Open TV / Custom Data Grabber plugin Benoire 2 2,984 2014-11-14, 02:05 AM
Last Post: Benoire
  API docs to help with plugin development? McBainUK 3 2,847 2013-06-08, 06:14 PM
Last Post: sub
  Refreshing TV Guide Data (after System plugin EPG update) imilne 13 6,294 2013-03-24, 08:03 PM
Last Post: imilne
  sabnzbd plugin to show processed files Wakalaka 1 2,007 2013-03-12, 06:48 AM
Last Post: psycik
  Integrated Development Environment (IDE) for plugins osx-addict 5 2,842 2012-10-18, 08:35 PM
Last Post: osx-addict
  Plugin problems with started from the command line mvallevand 11 5,170 2012-08-12, 07:56 PM
Last Post: sub

  • View a Printable Version
  • Subscribe to this thread
Forum Jump:

© Designed by D&D, modified by NextPVR - Powered by MyBB

Linear Mode
Threaded Mode