justin = { main feed , music , code , askjf , pubkey };
Ask Justin Frankel
No reasonable question unanswered since 2009!

Suggested topics: programming, music, sleep, coffee, etc.

Note: please do not ask questions about REAPER features, bugs or scheduling, use the forums instead.


Name: Ask: Human (enter yes):
[back to index] | [unreplied] | [replied] | [recent comments] | [all]

Question: Does JSFX support dynamic memory reallocation? for e.g doing this in @init "buffer_size = srate;" then doing this in @block srate != prev_srate ? ( buffer_size = srate; ); Is this true: "If you recalculated buffer_size in @block when the sample rate changes, you'd just be overwriting a variable, the actual allocated memory wouldn't change. JSFX doesn't support dynamic array resizing, so you're stuck with whatever memory was allocated at startup"
Asked by buffersize (102.176.75.x) on June 20 2026, 2:43pm
Reply on June 20 2026, 3:18pm:
    setting buffer_size = x doesn't affect memory, it's just a single variable. You have a fixed address space which you can use however you like. The first time you access a section of memory, it may be allocated transparently behind the scenes. You can control how big the memory is by using options: with e.g. maxmem=128000000 (for 128 million slots, the default is 32 million). You can also have it pre-allocate all of that memory by using prealloc=* or some by using prealloc=32000000 etc (oops need to document that).


Comments:
  • Posted by buffersize (102.176.75.x) on June 20 2026, 4:05pm:
    oh this is very good, thank you! I was so confused. Pls document it, it has saved me from bad coding.


Comment:
    Your Name:   -- Site Owner's Name:  (for human-verification)

    Comment:    

    
  
[back to index] | [unreplied] | [replied] | [recent comments] | [all]
Copyright 2026 Justin Frankel. | RSS