[Stk] Memory Allocation in STK

Gary Scavone gary at ccrma.Stanford.EDU
Tue, 12 Feb 2008 09:00:25 -0500


One extra point ... the vector class usually allocates more memory  
than initially requested, to avoid the type of behavior mentioned  
below.  And you can also ask it to allocate a certain amount of  
memory ahead of time.  So, as Richard indicates, this shouldn't be an  
issue in most contexts as currently used (and it can be avoided by  
specifying an allocations size before hand).

Regards,

--gary

On 12-Feb-08, at 5:52 AM, Richard Dobson wrote:

>  It's fine (talking about Filter here) so long as you don't change  
> the size of the filter (i.e. change the ~number~ of coefficients).  
> That's the only circumstance in which the allocator will be invoked  
> (see Filter.cpp); and not something you would want to do in the  
> processing loop anyway.
>
>
> Richard Dobson
>
>
> Jeremy Jurksztowicz wrote:
>> Hello,
>> I searched the archives with Google briefly, but my search terms came
>> up with no relevant info.
>> I noticed that in the Filter class, as well as Skini::Message, you  
>> are
>> using std::vector, which uses system memory allocation routines. In a
>> realtime threading context, system allocators are very dangerous,
>> because they could take more time to complete than the amount of time
>> the sound driver has to fill it's buffers. In the case of the Filter
>> class, if I want to safely change the coefficients during sound
>> processing, I have to take the filter class 'offline' (remove it from
>> the realtime sound stream somehow) adjust it's values and put it  
>> back.
>> Now, I know I understand basic realtime audio programming, but I am
>> not sure I understand STK (having just downloaded it recently), so I
>> may be missing something obvious (like a FAQ). Please forgive a
>> newbie, and point me to some info if you may.
>> Thanks,
>> Jeremy Jurksztowicz
>
>
> _______________________________________________
> Stk mailing list
> Stk@ccrma.stanford.edu
> http://ccrma-mail.stanford.edu/mailman/listinfo/stk