[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #38616] memory leak in regexprep
From: |
Christoph Ellenberger |
Subject: |
[Octave-bug-tracker] [bug #38616] memory leak in regexprep |
Date: |
Thu, 11 Apr 2013 20:54:29 +0000 |
User-agent: |
Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20100101 Firefox/17.0 |
Follow-up Comment #8, bug #38616 (project octave):
Ok I managed to build the latest tip on my box (Gentoo Core Duo E6750) at
home.
I found that the following worked as well without a glitch:
s="0123456789";
for i=1:21, s=cstrcat(s,s);,endfor
s = regexprep(s,'0','2');
s = regexprep(s,'1','2');
s = regexprep(s,'2','3');
but with your second suggestion I get the out of memory (As I don't have much
experience with gdb...did I do it right?):
octave:1> s = repmat ('2', 1, 2^23);
octave:2> s = regexprep (s, '2', '3');
error: memory exhausted or requested size too large for range of Octave's
index type -- trying to return to prompt
octave:2>
Program received signal SIGINT, Interrupt.
0xb7fe0424 in __kernel_vsyscall ()
(gdb) bt
#0 0xb7fe0424 in __kernel_vsyscall ()
#1 0xb642fd23 in __read_nocancel () from /lib/libpthread.so.0
#2 0xb606574b in rl_getc () from /lib/libreadline.so.6
#3 0xb6075f70 in rl_explicit_arg () from /lib/libreadline.so.6
free shows the following before I start:
total used free shared buffers cached
Mem: 3373344 543364 2829980 0 15568 150248
-/+ buffers/cache: 377548 2995796
Swap: 987992 393768 594224
Additionally I tested the inital problem. This gives no Error here. This seems
to be strictly Windows related and wil need the help of someone able to build
under Windows.
octave:1> s="0123456789";
octave:2> for i=1:21, s=cstrcat(s,s);,endfor
octave:3>
octave:3> s = regexprep(s,'0','2');
octave:4> s = regexprep(s,'1','2');
octave:5> clear all
octave:6> s="0123456789";
octave:7> for i=1:21, s=cstrcat(s,s);,endfor
octave:8> save "TestData.dat" s
octave:9> fid = fopen("TestData.dat","r");
octave:10> s = fscanf(fid,'%c');
octave:11> fclose(fid);
octave:12> s = regexprep(s,'0','2');
octave:13> clear all
octave:14> fid = fopen("TestData.dat","r");
octave:15> s = fscanf(fid,'%c');
octave:16> s = regexprep(s,'0','2');
octave:17> clear all
octave:18> fid = fopen("TestData.dat","r");
octave:19> s = fscanf(fid,'%c');
octave:20> fid = fopen("TestData.dat","r");
octave:21> s = fscanf(fid,'%c');
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?38616>
_______________________________________________
Nachricht gesendet von/durch Savannah
http://savannah.gnu.org/