Re: segmentation problem causes crash



Hi Emmanuel,

Probably seems like a long time since you resolved this,
but I am experiencing the same error and I am wondering if
you can recall what you did to fix it ?

Best regards,

Scott

"Emmanuel Witvoet" <emmanuel.witvoet@xxxxxxxxx> wrote in
message <ef4ffe1.2@xxxxxxxxxxxxxxxxxxxxxxx>...
Thanks, I figured it out eventually, but almost went
crazy!

Philip Borghesani wrote:


Something is corrupting MATLAB's memory, this is
probably not a
Windows
issue. First guess is a bad MEX file but I do not see
any mex file
use in a
quick check of your code.

Try starting MATLAB with the debug memory manager see
<http://www.mathworks.com/support/tech-
notes/1100/1106.html> or
<http://www.mit.edu/~pwb/cssm/matlab-faq.html>
his may point to the code
causing the problem.

Try isolating the problem to reproducible steps you
can post along
with a
link to a file data file or mail to support.

Phil

"Emmanuel Witvoet" <emmanuel.witvoet@xxxxxxxxx> wrote
in
message
news:ef4ffe1.-1@xxxxxxxxxxxxxxxxxxxxxxxxxx
Hi all,

I wrote a matlab program which detects NALU headers
in an h264
encoded video file. It worked fine, and was building
it
progressively. Yesterday, for some unknown reason, it
crashed
and
hasn't worked since. The error seems to be once here,
one
there..
I
can't figure it out..
Would someone have a clue?

my program is:

function [head GOP GOPdiff]=fileToMatrix1n (filename,
offset ,
BytSymb)

FIDnalu = fopen(filename,'r');
FIDtext=fopen('NALUlog.txt', 'wt');
fprintf(FIDtext,'F NRI UnitType Size \n');

offset=16448;
head=fread(FIDnalu,offset);

%buf=[0,0,0,0,0,0,0,0,0];
buf=[0,0,0,0,0,0,0];

GOP=[];
GOPdiff=[];

fseek(FIDnalu, 0, 'eof');

posfinal=ftell(FIDnalu);
posini=fseek(FIDnalu, offset,'bof');
display(ftell(FIDnalu));

buf(1)=fread(FIDnalu,1);
buf(2)=fread(FIDnalu,1);
buf(3)=fread(FIDnalu,1);
buf(4)=fread(FIDnalu,1);
buf(5)=fread(FIDnalu,1);
buf(6)=fread(FIDnalu,1);
buf(7)=fread(FIDnalu,1);
%buf(8)=fread(FIDnalu,1);
%buf(9)=fread(FIDnalu,1);

[dec2hex(buf(1), 2),'_', dec2hex(buf(2), 2),'_',
dec2hex(buf(3),
2),'_', dec2hex(buf(4), 2), dec2hex(buf(5), 2),
dec2hex(buf(6),
2),
dec2hex(buf(7), 2)]

GOP=[ftell(FIDnalu)-2]
previous_video=0

new_off=0;
new_off=ftell(FIDnalu)

before_pos=0;

header=[];

for i=1:(posfinal-7-new_off)

before_pos=ftell(FIDnalu);

[dec2hex(buf(1), 2),'_', dec2hex(buf(2), 2),'_',
dec2hex(buf(3),
2),'_', dec2hex(buf(4), 2), '_',dec2hex(buf(5), 2),
'_',dec2hex(buf(6), 2), '_',dec2hex(buf(7), 2)]

if isequal (buf(1:2), [0,0])
%display('found and byte aligned');
%display(ftell(FIDnalu)-4-offset);
%[dec2hex(buf(1), 2),'_', dec2hex(buf(2), 2),'_',
dec2hex(buf(3), 2),'_', dec2hex(buf(4), 2)]

S=hex2dec(cat(2,dec2hex(buf(3)),dec2hex(buf(4))));
if previous_video==1
curPos=ftell(FIDnalu)-3;
curDiff=curPos-GOP(end);
GOPdiff=cat(2,GOPdiff,curDiff);
GOP= cat(2, GOP,curPos);
end

header = buf(5);

F=bitand(power(2,7),header)/power(2,7);
NRI=bitand(power(2,6) + power(2,5),
header)/power(2,5);
UnitType= bitand(31,header);

fprintf(FIDtext,'%g %g %g %g
%s %s\n', F,NRI,UnitType,GOPdiff(end), dec2hex(S),
dec2hex(ftell(FIDnalu)));
%fprintf(FIDtext,'%g %g %g \n',
F,NRI,UnitType);

fseek(FIDnalu, S-4,0);

buf(1)=fread(FIDnalu,1);
buf(2)=fread(FIDnalu,1);
buf(3)=fread(FIDnalu,1);
buf(4)=fread(FIDnalu,1);
buf(5)=fread(FIDnalu,1);
buf(6)=fread(FIDnalu,1);
buf(7)=fread(FIDnalu,1);
previous_video=1;
else previous_video=0;
end

i=i+(ftell(FIDnalu)-before_pos);
buf(1)=[];
buf(7)=fread(FIDnalu,1);
end

fclose(FIDnalu);
fclose(FIDtext);

and the error (not always the same printout) can be :)

[a b GOP GOPdiff]=fileToMatrix1n
('test_h264_192_aac_24.3gp', 0
,
64)
??? Invalid function name ''



---------------------------------------------------------
-----------
--
--
Assertion detected at Fri Mar 09 16:45:14 2007


---------------------------------------------------------
-----------
--
--

Assertion failed: count==0, at line 314 of file
".\memmgr\mem32aligned.cpp".

Configuration:
MATLAB Version: 7.3.0.267 (R2006b)
MATLAB License: 297118
Operating System: Microsoft Windows 2000
Window System: Version 5.0 (Build 2195: Service Pack
3)
Processor ID: x86 Family 15 Model 1 Stepping 2,
GenuineIntel
Virtual Machine: Java 1.5.0 with Sun Microsystems
Inc. Java
HotSpot(TM) Client VM mixed mode
Default Charset: windows-1252

Stack Trace:
[0] bridge.dll:_




.



Relevant Pages

  • segmentation problem causes crash
    ... I wrote a matlab program which detects NALU headers in an h264 ... encoded video file. ...
    (comp.soft-sys.matlab)
  • Re: Newbie questions
    ... is how to structure a matlab program i have a gui function that ... > Duane Hanselman wrote: ... >> Josh Drayton wrote: ... >>> Hi i'm extremly new to matlab and have no idea on how to ...
    (comp.soft-sys.matlab)
  • Re: Runtime Error!
    ... Does anyone know of any MATLAB code that could cause such an error? ... It sounds like you are running a matlab program which was compiled to a .exe ... You could also try to use exception handling in Matlab to catch the run-time ...
    (comp.soft-sys.matlab)
  • Re: MATLAB working with .exe
    ... possible that while a MATLAB program is running, ... file is called upon and then the MATLAB compiler would ... the .exe file or is this an instance where we need ...
    (comp.soft-sys.matlab)
  • Re: MATLAB working with .exe
    ... possible that while a MATLAB program is running, ... the .exe file or is this an instance where we need ... system% Call the routine to perform the calculations ...
    (comp.soft-sys.matlab)