P-Code Generation Segmentation Fault

조회 수: 1 (최근 30일)
D G
D G 2012년 5월 8일
댓글: Frank Drop 2014년 10월 16일
Hello!
I am running a script to recursively generate p-code. This has been working fine up until 2012a, but now it gives a segmentation fault on a single specific file every time I try to run it for a certain application.
Is there something that I need to update along with MATLAB? What could cause this?
Thanks

채택된 답변

Sean de Wolski
Sean de Wolski 2012년 5월 8일
편집: Sean de Wolski 2014년 10월 14일

추가 답변 (2개)

Frank Drop
Frank Drop 2014년 10월 14일
I am having exactly the same issues. I am recursively walking through a number of folders and pcode'ing their content. The first run works, the second time I run the code (within a MATLAB session) I get a segmentation error. After restarting MATLAB I can run the code once, and then I get a segmentation error again.
  댓글 수: 1
Sean de Wolski
Sean de Wolski 2014년 10월 14일
Frank, what is the result of the following after the first run?
op = fopen('all')
If anything is open, if you
fclose all
Does the crash still happen?

댓글을 달려면 로그인하십시오.


Frank Drop
Frank Drop 2014년 10월 15일
편집: Frank Drop 2014년 10월 15일
After I run the recursive function I do op = fopen('all') which gives an empty array as result:
op =
[]
Then before rerunning I do
fclose all
But the problem persist.
I did some more tests with the function. Basic functionality is:
function recursivePCode(sourceFolder,destinationFolder)
cd(destinationFolder); % The function moves to the folder where the p code should reside.
pcode(sourceFolder); % Creates the p functions and stores it in destinationFolder
for all subfolders in destinationFolder
recursivePCode(sourceFolder/subfolder_n,destinationFolder/subfolder_n);
end
end
Now, if I run:
recursivePCode('D:\sourceFolder','D:\destinationFolder');
recursivePCode('D:\sourceFolder','D:\destinationFolder');
recursivePCode('D:\sourceFolder','D:\destinationFolder');
It will give a segmentation error during the second recursivePCode call. However, if I run...
recursivePCode('D:\sourceFolder','D:\destinationFolder1');
recursivePCode('D:\sourceFolder','D:\destinationFolder2');
recursivePCode('D:\sourceFolder','D:\destinationFolder3');
... all is fine. It seems overwriting the existing pcode is the problem. So now I attempt to delete the existing p-files in the destination folder before running pcode(), but the problem still persists.
The pcode function appears to crash on p-coding a classdef folder called '@CacheProcessData5'.
  댓글 수: 5
Sean de Wolski
Sean de Wolski 2014년 10월 15일
If you can create a minimal working example, please send it to MathWorks Tech Support so that they can pass it along to development. Unless it's in a custom MEX file, a bug in your code should not cause a segv.
Frank Drop
Frank Drop 2014년 10월 16일
I just tried reproducing the problem, but even without deleting the files in the destination folder, the problem does not arise anymore.
I am guessing now that it (also) had something to do with the fact that the destination folder is a shared network folder (shared in the windows network) and perhaps other PCs had a lock on this folder or something like that? If the problem comes back I will post again.
Are segmentation errors more likely on old installations or perhaps sensitive to updates to the JVM? I've once ran into segmentation errors all of a sudden (no change to the matlab code) when I first ran the particular code on a certain morning (java updates are automatically installed here at work during night time). I traced this segmentation error down to a
load('somematfile.mat')
statement, which would load a variable 'd' to the function workspace, after which the function would operate on d. The segmentation error disappeared after adding
d = [];
on the line before the load statement.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by