[PD] Question about Data Structures and passing pointers around...

Mike McGonagle mjmogo at gmail.com
Tue Oct 3 20:16:10 CEST 2006

On 10/3/06, Frank Barknecht <fbar at footils.org> wrote:
> Hallo,
> Mike McGonagle hat gesagt: // Mike McGonagle wrote:
> > I have found that when sending messages, it is far more efficient to
> > pass pointers to data structures, rather than passing a list of all
> > the parameters in the data structure. But, it also seems that I need
> > to append a new data structure to a canvas that is used to store this
> > instance data. Because I am working with granular synthesis, I am
> > generating a lot of data, and a lot of elements in the canvas data
> > structure.
> >
> > While so far, in playing with what I have done, I have not really run
> > into any problems with running out of memory to store all my instance
> > data, I was just curious is there are any concerns revolving around
> > creating a lot of instance data within a canvas data structure.
> I have found that drawing a lot of data structures can have a bad
> effect on performance, but if you either close the [pd data] subpatch
> or if you use structures without graphical representations (yes,
> that's of course possible) you won't experience this.

This is just as well, as I am not really plotting any graphics.

> Another issue that has been reported in the past is a kind of
> corruption of the patch if you stored too much data inside the patch.
> It may happen, that Pd isn't able to open this patch anymore because
> it has to restore too much data in the data-window on startup.

I have seen this, too. It happened on one of my patches, and the only
solution was to open it up in a text editor, and manually delete all
the data from the subpatch.

> Clearing the data window before saving is a way around this problem.
> You can also save the data to an external file before closing the
> patch and then restore from that file later. This seemed to happen
> for example if you use structs with large arrays.

Is there a way to save the data directly from the subpatch? Or would
the data need to be copied into a textfile object, and written from

What I am trying to get at is it would be nice if it were possible to
create this instance data, pass it to the objects that need that data,
and then have it deleted from the subpatch once it is no longer
required. I am working on creating some granular synthesis stuff, and
as a result, there is a lot of data that gets generated. I found this
out the hard way, as one of my patches (when I accidentally saved it)
ended up being on the order of 18 megs, and this made me wonder if
there is a limit that PD has while running in realtime.



> Ciao
> --
>  Frank Barknecht                 _ ______footils.org_ __goto10.org__
> _______________________________________________
> PD-list at iem.at mailing list
> UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list

Help the Environment, Plant a Bush back in Texas!

"I place economy among the first and most important republican
virtues, and public debt as the greatest of the dangers to be feared.
To preserve our independence, we must not let our rulers load us with
perpetual debt."
-- Thomas Jefferson, third US president, architect and author (1743-1826)

"Give Peace a Chance" -- John Lennon (9 October 1940 – 8 December 1980)

More information about the Pd-list mailing list