[PD-dev] message passing

Krzysztof Czaja czaja at chopin.edu.pl
Mon Jun 10 16:47:58 CEST 2002


hi again,

in order to somehow put an end to this boring thread (who said dev
list has to be interesting?), let me report my latest findings.

After performing a number of tests in max 4.0 (also checking the
few examples in its sdk) I am pretty sure all the simple classes
in max use a preallocated, fixed-sized output buffer, with no
special care for reentrancy.  Since this buffer never grows,
reentrant calls are `safe'.

Anyway, I finally decided to adopt a slightly mixed scheme
(because I intend to handle messages of any size).  This is
a comment snippet from my code:

Usually a preallocation method is used, except in special cases
of:  1) reentrant output request, or 2) an output request which
would cause resizing to more than MAXSIZE (no such limit for
a 'set' message).  In both special cases, a temporary output
buffer is allocated.  A separately preallocated output buffer is
not used, thus avoiding memcpying of the stored message (a small
performance gain when the preallocation method is chosen).
Instead, self-invoked 'set' messages are postponed, using an
auxiliary buffer.

If you see any serious flaw in this method, please let me know...

Krzysztof





More information about the Pd-dev mailing list