mimic-sussex / sema

Sema – A Playground for Live Coding Music and Machine Learning
https://sema.codes
MIT License
151 stars 51 forks source link

(probably memory) error with slicer / maxiSample #308

Open chriskiefer opened 3 years ago

chriskiefer commented 3 years ago

keep on reloading slicers, eventually the audio engine has a critical error

sema-engine.wasmmodule.js:1267 undefined abort @ sema-engine.wasmmodule.js:1267 _abort @ sema-engine.wasmmodule.js:6012 operator new(unsigned long) @ 0021836e:0x3adbc maxiSample::setSample(std::2::vector<double, std::2::allocator >&) @ 0021836e:0x41b4 emscripten::internal::MethodInvoker<void (maxiSample::)(std::2::vector<double, std::2::allocator >&), void, maxiSample, std::2::vector<double, std::2::allocator >&>::invoke(void (maxiSample:: const&)(std::2::vector<double, std::2::allocator >&), maxiSample, std::2::vector<double, std::2::allocator >*) @ 0021836e:0x4284 maxiSample$setSample @ VM57:9 proto. @ sema-engine.wasmmodule.js:4449 eval @ VM503:10 eval @ maxi-processor.js:457 onMessageHandler @ maxi-processor.js:539 engine.js:698 On Processor Message Error: abort(undefined). Build with -s ASSERTIONS=1 for more info.

this particular example was using a few long samples (loaded locally)

we need to make sure maxisample is deallocating memory properly

chriskiefer commented 3 years ago

:l3:{{:m2:}imp,{{0.01}pha,0.1,0.4}ulin}|fbcell; :l4:{{:m3:}imp,{{0.01}pha,0.3,0.9}ulin}|fbcell; :l5:{{:m6:}imp,{{0.01}pha,0.0,0.9}ulin}|pg2; :l6:{{:m5:}imp,{{0.1}pha,0.1,0.8}ulin}|pg1; :l7:{{:m6:}imp,{{0.01}pha,0.1,0.8}ulin}|fence; :l8:{{:m7:}imp,{{0.01}pha,0.1,0.8}ulin}|fence;

chriskiefer commented 3 years ago

the audio actually carries on playing, but you can't evaluate new code

chriskiefer commented 3 years ago

further note: looking at the code, this is complex stuff crossing the js/emscripten boundary. why not export maxiSample using CHEERP instead? Then memory stays within JS scope, no need to make copies of sample data