Crashes in tight loops
Opened this issue · 0 comments
jankap commented
First thank you very much for this awesome package.
I'm trying to run the stuff in performance.m
and unfortunately, the first test fails. Could have to do with the JIT compiler of Matlab:
>> k=1;while(true), [q,r] = jl.call('divrem',7,3); k=k+1; end
Array indices must be positive integers or logical values.
Error in jl.mex (line 23)
[err, varargout{1:nout}] = mexjulia('jl_mex', fn, varargin{:});
Error in jl.callkw (line 52)
[varargout{1:nargout}] = jl.mex('Mex.jl_call_kw', fn, int32(npos), varargin{:});
Error in jl.call (line 59)
[varargout{1:nargout}] = jl.callkw(fn, -1, varargin{:});
Using dbstop if error
reveals, that the value of k
differs a lot, sometimes it's in the range of 40, sometimes 10000. But it crashes. Is some kind of locking neeeded?
Thanks!
edit 1:
try, k=1;while(true), [q,r] = jl.call('divrem',7,3); pause(0.1), k=k+1; end, catch E, E, k, end
always returns k=50
on my machine, regardless of the value in pause()
.
edit 2:
tic; for i=1:2000; [q,r] = divrem(7,3); end; elpsd = toc;
always works. Is there something wrong with jl.call
?