| Environment Csound5 (release THANKS to all the developers!!!) - Java API
- Windows XP
After receiving a message of low virtual memory ressource, I have
checked the memory usage of my Java program, and constated that it is
consuming more and more memory during its execution (1 Ko each second).
After hunting what part of the program can be responsible, I found that
it is the perform() API.
The loop is in the run() method of a Thread
public void run() {
try {
setRunning(true);
cs.Perform();
cs.delete();
setRunning(false);
}
catch( Exception ex ) {
ex.printStackTrace();
}
}
I have then checked with CsoundVST : same behaviour. Thus, I have tried
to isolate the opcode, and the winner is waveset
Just comment the line "asig1w waveset asig1+ab1, 0.1" in the following
CSD, to have a perfect stability in memory usage.
Normal?
-d -g -odac0 -b256 -B4096 temp.orc temp.sco
sr = 44100.0
kr = 44100.0
ksmps = 1.0
nchnls = 2
zakinit 2, 2
gkchrms20 chnexport "CHRMS20",2 ; RMS
gkch20_1 chnexport "CH20_1",2 ; Evolution 1 Instrument 20
gkch20_2 chnexport "CH20_2",2 ; Evolution 2 Instrument 20
gkch20_3 chnexport "CH20_3",2 ; Evolution 3 Instrument 20
gkch20_4 chnexport "CH20_4",2 ; Evolution 4 Instrument 20
instr 1 ; Loop Segment Evolutions
gkch20_1 loopseg 0.05,0 , 0.0,0.0, 0.23,1.0, 0.5475,0.9209, 0.2225,0.0
gkch20_2 loopseg 0.0314,0 , 0.0,0.0, 0.3711,0.2905, 0.1242,1.0, 0.5047,0.0
gkch20_3 loopseg 0.0222,0 , 0.0,0.0, 0.4091,1.0, 0.5909,0.0096
gkch20_4 loopseg 0.0295,0 , 0.0,0.0, 0.1652,0.06, 0.1298,1.0,
0.118,0.0504, 0.177,0.0, 0.2006,0.4197, 0.2094,0.0
endin
instr 20
if1 = cpspch(5.0)
if2 = cpspch(5.03)
if3 = cpspch(5.05)
iharms1 =(sr*.4) / if1 ; Limits number of harmonics in bandlimited
pulse waveform
ab1 gbuzz 1, if1, iharms1, 1, .9,2
iharms2 =(sr*.4) / if2 ; Limits number of harmonics in bandlimited
pulse waveform
ab2 gbuzz 1, if2, iharms2, 1, .9,2
iharms3 =(sr*.4) / if3 ; Limits number of harmonics in bandlimited
pulse waveform
ab3 gbuzz 1, if3, iharms3, 1, .9,2
kph1 randomi 300, 3800, .1
asig1 phaser1 ab1 + ab2 + ab3, kph1, 64, .95
kph randomh 200, 5600, ( gkch20_2 * 0.9 + 0.1 )
asig2 phaser1 asig1, kph, 64, .95
asig1w waveset asig1+ab1, 0.1 ; time to buy memory if the score
duration is very very very long
endin
f1 0.0 65536 10 1
f2 0.0 16384 11 1
i1 0 300.0
i20 0 300.0
Jean-Pierre
|