hickinbottoms;377396 Wrote: 
> Thanks for taking a look at that, Andy. I'd had that refactoring on my
> list for a while
> (http://hickinbottom.demon.co.uk/lazysearch/ticket/70)
> so I'll get around to that for the next version.
> 
> andyg wrote:
> > LazySearch: OK, but I want to strongly recommend this plugin be
> > refactored to not use global variables and use $client->pluginData
> > instead.  As it is today, it almost certainly leaks memory.

Could you say more about the memory leak concern? I can't imagine a
problem in a typical SqueezeCenter setup, though I think I can imagine
the problem in SqueezeNetwork. In SqueezeCenter, with the normal
$hashVar{$client->id()} approach, %hashVar could only grow as new
players connected, and if you're not allowing public access to
/stream.mp3, the list of client ID values should be not only a finite
set, but also pretty small -- right? In SqueezeNetwork, with tens of
thousands of $client->id() values, sure, I see the need for garbage
collection, and the merit of having the GC bulit into Client.pm instead
of subscribing to client disconnect events and writing per-plugin GC
routines. But in SqueezeCenter, with the only same few MAC address IDs
use, is memory leakage with $hashVar{$client->id()} a real problem?

andyg;291659 Wrote: 
> On Apr 15, 2008, at 9:41 AM, max.spicer wrote:
> >
> > I notice that Client::pluginData() replaces $client with
> > Sync::masterOrSelf($client).  Is this really right?  I'd have
> thought
> > there are many situations where you'd want to treat two clients
> > differently, even if they do happen to be synced.
> 
> That's a good question, for all the plugins I'm using this for now it 
> 
> seems to be the right thing to do.  But I guess if for some reason you 
> 
> wanted to seek on multiple synced players at the same time you might  
> have an issue with that.

1) In most of my plugins, I think I'd want per-client data pools, not
per sync group.

2) Couldn't pluginData() -- with its current
masterOrSelf()/$client->master() behavior -- lead to other
hard-to-trace bugs? Plugin starts doing something while a player is
synced, uses $client->pluginData('foo'), then when the player unsyncs,
$client->pluginData('foo') suddenly doesn't have the old data? ISTM
it'd be better to make a new API without that "$client =
$client->master();" logic so developers can choose the behavior they
want.

As it stands now, not only do I not understand why
$hashVar{$client->id()} is a problem in SqueezeCenter, I don't think I
could use $client->pluginData to replace my use of things like
$hashVar{$client->id()} unless/until you provide a new API like
$client->pluginData that doesn't have the $client->master() behavior.
And even then I wouldn't *want* to use it, as currently all my plugins
support 7.0+ -- if you changed pluginData or made a new API, I'd have
to stop supporting older versions of SC in order to start using the new
API. :-(

Thanks,

Peter


-- 
peterw

http://www.tux.org/~peterw/
free plugins: http://www.tux.org/~peterw/#slim
AllQuiet BlankSaver ContextMenu FuzzyTime KidsPlay
KitchenTimer PlayLog PowerCenter/BottleRocket SaverSwitcher
SettingsManager SleepFade StatusFirst SyncOptions VolumeLock
------------------------------------------------------------------------
peterw's Profile: http://forums.slimdevices.com/member.php?userid=2107
View this thread: http://forums.slimdevices.com/showthread.php?t=56697

_______________________________________________
plugins mailing list
plugins@lists.slimdevices.com
http://lists.slimdevices.com/lists/listinfo/plugins

Reply via email to