P-Code Generation Segmentation Fault
2 次查看(过去 30 天)
显示 更早的评论
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
0 个评论
采纳的回答
更多回答(2 个)
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
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
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
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
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 Center 和 File Exchange 中查找有关 Startup and Shutdown 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!