[Gridflow-dev] [bug] segfault in gfmemcopy (with dim[6561, 6561, 3])

Mathieu Bouchard matju at artengine.ca
Sat Jul 30 20:12:24 EDT 2005


On Fri, 29 Jul 2005, ClaudiusMaximus wrote:

> I've been working with some dim[6561,6561,3] grids, and sometimes
> Gridflow/Pd segfaults (even with pd -nogui with loadbang to trigger the
> calculation, with no other programs running - I have 1GB ram and 1GB
> swap).

a int32 is 4 bytes (duh), so you can find your grid's size using:

-> [#dim] -> [#fold *, seed 4]

What [#out] gets is thus 6561*6561*3*4 = 492.63 megs

Hmm what is the [#redim (6561 6561)] in your patch for? Just by reading
the patch, I don't see any use for it.

replace [fork]=>[# *] by just [# sq- (f # 0)], it will save you a buffer
of size 6561*6561*2*4 = 328.42 megs (each pixel being a pair of floats at
that level).

The rule is that right-inlets have buffers while left-inlets don't (are
"passthru"). However, a few objects do insist on setting a blocksize the
same size as the grid. For example, [#convolve] and a few variants of
[#out] and [#in]. Fortunately, GridFlow doesn't have patcher-wide
blocksizes, and the disease doesn't propagate thru any given chain of
objects either, because GridFlow always falls back to small blocksizes
(e.g. 4096) as soon as it can. However [#out targa] only requires 
whole-pixel blocksizes (e.g., for a RGB picture, blocksize will just be
multiple of 3... so blocksize _can_ be small here)

> Surprisingly, a patch with [#store] and feedback worked fine at that
> image size, but the attached patch segfaults consistently in gfmemcopy.

a feedback [#store] requires two buffers, times 500 megs = 1 gig.

the patch you attached looks like it would use 330 megs because there is 
only the [# *] that had to have a full-frame buffer. So I have to say I am 
as puzzled as you are.

Wanna write a RAM profiler for GF ? :-)

Actually, it seems that getting rid of [# *] makes a big difference.

Because of that, your patch works and produces a 4-meg .tga.gz file.
I only had to send a "close" message at the end.

____________________________________________________________________
Mathieu Bouchard - tél:+1.514.383.3801 - http://artengine.ca/matju
Freelance Digital Arts Engineer, Montréal QC Canada



More information about the Gridflow-dev mailing list