[PD] symbol anxiety
Phil Stone
pkstone at ucdavis.edu
Mon Feb 23 19:35:15 CET 2009
Frank Barknecht wrote:
> Hallo,
> Phil Stone hat gesagt: // Phil Stone wrote:
>
>
>> Attached is [maketime], a lovely little timer/stopwatch. I've long
>> since lost track of who made it, so I'm sorry can't give you
>> well-deserved credit here. At any rate, it creates *at least* one
>> symbol per second (probably more, I'm not sure if each [makefilename]
>> generates a new symbol, but I'm guessing it does). This makes me
>> nervous, as I have no idea what the symbol table capacity is, or how to
>> see how "full" it is. It seems likely that this abstraction would crash
>> eventually.
>>
>
> A fix for this maketime would be to reuse the symbols ":00" ... ":59"
> for minutes and hours by using two [cnv] objects for these. Then you
> would be able to let the clock run for decades before you get into
> trouble with the symbol table.
>
I've pondered this, and can't figure out what you mean, unless you're
suggesting having 60 canvases, one for each possible number?
I did re-work [maketime] a little. Attached is a version (called
[ps-stopwatch] that adds some features and only creates one symbol per
second (plus one per minute, plus one per hour); the original created
six per second. The new one requires zexy's [makesymbol] (which can
convert lists of numbers into a single symbol -- perfect for this
application, but not in Vanilla-Pd, obviously).
> Every table or receiver or route-selector etc. also is a symbol.
Yes, but except in some extreme examples of dynamic programming, this is
a known quantity. My anxiety comes from the memory leak behavior of
long-running patches that dynamically create symbols (anything that does
any sort of string handling is in this category, usually). It would be
so much better to have transient symbols for this sort of thing, but as
Mathieu said, it sounds like this is not going to happen any time soon.
> So
> while the implementation of the symbol table is suboptimal, in practice
> it's not something you need to worry about too much. At least it should
> not make you replace [route freq note] with [route 0 1] :-)
>
Just to see the magnitude of the issue, I made a little test patch
(attached) called [symbol_pig]. It just creates symbols, very fast. A
very rough measurement based on watching resident memory increasing in
bash's top command indicates that (on OS X 10.4), a megabyte is used up
for approximately every 32,000 symbols.
Phil
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: symbol_pig.pd
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20090223/5d48e752/attachment.asc>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: ps-stopwatch.pd
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20090223/5d48e752/attachment.txt>
More information about the Pd-list
mailing list