Csound Csound-dev Csound-tekno Search About

[Csnd] limit to how many instruments?/ mallocs and segmentation faults abound

Date2014-08-13 11:38
FromNye Parry
Subject[Csnd] limit to how many instruments?/ mallocs and segmentation faults abound
Hi All

I have been getting segmentation faults and other memory allocation issues when generating large amounts of instrument calls. Is there anything I can do about this?

Ive put an example orch (based on Joachim Heinz's tutorial) below with the output I get. The problem varies slightly according to the instruments and whether they are active simultaneously. With the example orch I run into problems at 4494 instances. Up to then it runs fine. (With all instruments starting at 0 its slightly less at 3697 calls)

In practice I am only doing about 100 calls from one loop but running the calling instrument many times so I get segmentation faults very quickly.

I am running on a mac book pro OSX10.8.5 CSound v. 6.02.

The error reports vary and sometimes it complains of an illegal opcode 0

thanks in advance - I can provide more info if necessary

<CsoundSynthesizer>

<CsOptions>

</CsOptions>

<CsInstruments>


sr = 44100

ksmps = 128

nchnls = 2

0dbfs = 1.0


instr 1 ; master instrument with event pool


itimes = 4494 ;number of events to produce

icnt = 0 ;counter



Slines = ""


loop1: ;start of the i-time loop


Sline sprintf "i 2 %d 0.5\n", icnt ;new scoreline

Slines strcat Slines, Sline ;append to previous scorelines



loop_lt icnt, 1, itimes, loop1 ;end of the i-time loop

print icnt

; puts Slines, 1 ;print the scorelines

scoreline_i Slines ;execute them


endin


instr 2


endin





</CsInstruments>

<CsScore>


i1 0 10


</CsScore>

</CsoundSynthesizer>




The output is:

Last login: Wed Aug 13 11:54:04 on ttys000
wlan-public-223:~ nyesonic$ /var/folders/w0/ts_m5qx17_z7gxcqwwbqmpp80000gn/T/csoundqt_run_script-QQg263.sh ; exit;
csound --format=wav:short --env:CSNOSTOP=yes /Users/nyesonic/Projects/ZKM/problemdemo.csd
virtual_keyboard real time MIDI plugin for Csound
0dBFS level = 32768.0
Csound version 6.02.0 (double samples) Jan  7 2014
libsndfile-1.0.21
WARNING: could not open library '/Library/Frameworks/CsoundLib64.framework/Versions/6.0/Resources/Opcodes64/libjacko.dylib' (-1)
WARNING: could not open library '/Library/Frameworks/CsoundLib64.framework/Versions/6.0/Resources/Opcodes64/libjackTransport.dylib' (-1)
WARNING: could not open library '/Library/Frameworks/CsoundLib64.framework/Versions/6.0/Resources/Opcodes64/librtjack.dylib' (-1)
UnifiedCSD:  /Users/nyesonic/Projects/ZKM/problemdemo.csd
STARTING FILE
Creating options
Creating orchestra
Creating score
rtaudio: PortAudio module enabled ...
using callback interface
rtmidi: PortMIDI module enabled
Elapsed time at end of orchestra compile: real: 0.002s, CPU: 0.002s
sorting score ...
    ... done
Elapsed time at end of score sort: real: 0.002s, CPU: 0.002s
Csound version 6.02.0 (double samples) Jan  7 2014
graphics suppressed, ascii substituted
0dBFS level = 1.0
orch now loaded
audio buffered in 1024 sample-frame blocks
writing 4096-byte blks of shorts to test.wav (WAV)
SECTION 1:
new alloc for instr 1:
instr 1:  icnt = 4494.000
B  0.000 .. 10.000 T  9.999 TT  9.999 M:  0.00000  0.00000
Score finished in csoundPerform().
csound(1191,0x7fff79fbf180) malloc: *** error for object 0x1008c5a08: incorrect checksum for freed object - object was probably modified after being freed.
*** set a breakpoint in malloc_error_break to debug
Csound tidy up: Abort trap