binbuf limits?

Mar 4, 2006 at 9:13pm

binbuf limits?

Dear Cyclers,

I’m having some issues with a new object under development. The object
is designed to store large amounts of inside the patcher in response to
a psave message. There seem to be problems with patcher corruption when
the amount of data gets up to the +30k range.

I don’t see a documented limit on the size of binbufs in the
documentation. Is there one?

I’m following the model in the documentation section on implementing a
psave method. Works swell for modest amounts of data.

I can give more nitty-gritty about what I’m doing, but if this is just
a size limitation then we can focus on that and workarounds.

Thanks,
Peter

————– http://www.bek.no/~pcastine/Litter/ ————–
Peter Castine | ^
| Litter Power & Litter Bundle for Jitter
pcastine@gmx.net |
pcastine@bek.no | iCE: Sequencing, Recording, and Interface Building
4-15@kagi.com | for Max/MSP
| Extremely cool
| http://www.dspaudio.com
| http://www.dspaudio.com/software/software.html

#24706
Mar 6, 2006 at 7:59pm

Peter,
I’m not sure where your binbuf is stored, but if it’s in your object’s
struct, there is a 32K limit, so you need to dynamically allocate
anything more than that. I got the following suggestion from jkc a
while back:

For example, instead of:

typedef struct _foo
{
t_object * ob;
float myarray[10000]; //(40kb==bad)
} t_foo;

declare as:

typedef struct _foo
{
t_object *ob;
float *myarray; //(4bytes==good)
} t_foo;

hth,
jim

#71926
Mar 7, 2006 at 9:59am

Thanks for the response, but this isn’t the issue I’m having…

On 6Mar2006, at 20:59, jim altieri wrote:
> float myarray[10000]; //(40kb==bad)

Yeah, I’ve known about that since 68k days, it’s usually a compile
time issue (or used to be), and I’m not even sure it’s in issue on OS
X/XP any more. But that’s not my problem.

My problem is a standard UI object psave method, with the following
signature:

xxxPSave(objXXX* me, void* ioBBuf)

which generates a string of binbuf_vinsert() calls like the following

binbuf_vinsert(ioBBuf, “ssslll”, gensym(“#P”), gensym(“user”), gensym
(kClassName), tl, br, font);
.
. // bunches of more binbuf_vinsert()s to store data, settings, etc.
.
binbuf_vinsert(ioBBuf, “ss”, gensym(“#T”), gensym(“done”));

The number of calls to binbuf_vinsert() depends upon the object state
at psave time. This works fine. Until, apparently, at somewhere in
the 30k region it starts corrupting patchers. I haven’t been able to
pin down the exact threshold from testing yet, but 32764 bytes seems
the most likely suspect in this particular ballpark.

What I need to know is the following:

a) is there a limit (32k or otherwise) on the size a binbuf can grow
to?

and (much more importantly)

b) how do I psave data bigger than that?

I hope the problem is clear now.

Best — Peter

#71927
Mar 16, 2006 at 8:11pm

I’d like to come back to my psave problems, hoping someone is reading
who knows more about the innards of binbuf_vinsert()…

======
My problem is a standard UI object psave method, with the following
signature:

xxxPSave(objXXX* me, void* ioBBuf)

which generates a string of binbuf_vinsert() calls like the following

binbuf_vinsert(ioBBuf, “ssslll”,
gensym(“#P”), gensym(“user”),
gensym(kClassName), tl, br, font);
.
. // bunches of more binbuf_vinsert()s to store
. // data, settings, etc.
.
binbuf_vinsert(ioBBuf, “ss”, gensym(“#T”), gensym(“done”));

The number of calls to binbuf_vinsert() depends upon the object state
at psave time. This works fine. Until, apparently, at somewhere in
the 30k region it starts corrupting patchers. I haven’t been able to
pin down the exact threshold from testing yet, but 32764 bytes seems
the most likely suspect in this particular ballpark.

What I need to know is the following:

a) is there a limit (32k or otherwise) on the size a binbuf
can grow to?

and (much more importantly)

b) how do I psave data bigger than that?

Best — Peter

————– http://www.bek.no/~pcastine/Litter/ ————-
Peter Castine | +–> Litter Power & Litter Bundle for Jitter
|…………………………………………….
p@castine.de | iCE: Sequencing, Recording, and Interface Building
pcastine@gmx.net | for Max/MSP
pcastine@bek.no | http://www.dspaudio.com/ Extremely cool
4-15@kagi.com |…………………………………………….
| home|chez nous|wir|i nostri http://www.castine.de/

#71928
Mar 16, 2006 at 8:40pm

Because you so generously exceeded your .sig’s length with pertinent and
interesting information, I’ve decided to return the favor. Just took a
look at the code for binbuf_(v)insert and no, there doesn’t appear to be
a hard size limit for a binbuf, if I’m reading it all correctly.

I guess that you could be running into the 32k getbytes limit (unless
that doesn’t exist anymore — but I think that it does) with some other
code that’s being executed in conjunction with all of this saving
activity and trashing memory somehow. Or there could be some other bug
somewhere else in our saving code.

The fastest way to determine where it’s all screwing up would be to send
us a bit of code. If you would be so kind as to send me a prototype
object with source + a patch that corrupts on save, that would be great,
and I promise I’ll look at it in short order.

jb

#71929

You must be logged in to reply to this topic.