Azzera filtri
Azzera filtri

P-Code Generation Segmentation Fault

1 visualizzazione (ultimi 30 giorni)
D G
D G il 8 Mag 2012
Commentato: Frank Drop il 16 Ott 2014
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

Risposta accettata

Sean de Wolski
Sean de Wolski il 8 Mag 2012
Modificato: Sean de Wolski il 14 Ott 2014

Più risposte (2)

Frank Drop
Frank Drop il 14 Ott 2014
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 Commento
Sean de Wolski
Sean de Wolski il 14 Ott 2014
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?

Accedi per commentare.


Frank Drop
Frank Drop il 15 Ott 2014
Modificato: Frank Drop il 15 Ott 2014
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 Commenti
Sean de Wolski
Sean de Wolski il 15 Ott 2014
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 il 16 Ott 2014
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.

Accedi per commentare.

Categorie

Scopri di più su Startup and Shutdown in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by