From help-octave-request at bevo dot che dot wisc dot edu Thu Oct 12 04:21:36 1995 Subject: Memory usage? From: Eyal Doron To: help-octave at bevo dot che dot wisc dot edu (Octave mailing list) Date: Thu, 12 Oct 1995 10:20:29 +0100 (MET) Hi guys, I seem to have a memory leak problem of some kind. Can anybody explain? I'm running the following script in the background: a=0.4, delta=0.2, Nreturn=65:75 Rlist=1:0.01:1.5; klist=106+(0:200)/200*20; klist=klist(35:length(klist)); Split=zeros(length(Nreturn)*length(Rlist)*length(klist),1); TunAmp=Split; tic; block=length(Nreturn)*length(Rlist); for ik=1:length(klist) [split,tunamp]=splitstat(klist(ik),a,delta,Rlist,Nreturn); Split((ik-1)*block+(1:block))=split; TunAmp((ik-1)*block+(1:block))=tunamp; save splittings3.mat a delta Nreturn Rlist klist Split TunAmp ik printf("Elapsed time is %g minutes\n",round(toc/60)), fflush(stdout); end Never mind what "splitstat" does, the main thing is that the main variables "Split" and "TunAmp" are pre-allocated, before the loop is invoked. Nevertheless, the "SIZE" reported by the "top" command increases as the loop progresses, until the program crashes. Currently it is reporting: goofy:annular> top -n last pid: 32683; load averages: 1.00, 1.02, 1.00 10:12:11 101 processes: 2 running, 15 sleeping, 81 idle, 3 stopped Memory: Real: 30M/54M act/tot Virtual: 179M/212M use/tot Free: 3984K PID USERNAME PRI NICE SIZE RES STATE TIME CPU COMMAND 18687 doron 61 10119360K 20250K run 1187:44 94.90% octave.bin and virtual memory is about to be exhausted. What is going on? Why is the "SIZE" increasing if the matrices are pre-allocated? Thanks, Eyal Doron