imresize using NaN and parfor causes memory error

1 view (last 30 days)
I've used imresize (using the NaN option) in a parfor and I've got a memory error. However, without the NaN option (see case 2 below - namely by calculating the target dimension in advance) it worked perfectly
e.g.
case 1: I2=imresize(I,[256 NaN]);
case 2: I2=imresize(I,[256 256]);
  • case 1 or case 2 + for, OK
  • case 2 + parfor, OK
  • case 1 + parfor, memory error
Do you have any idea why this is happening?
I thank you in advance
Vassilis
  3 Comments
Vassilios
Vassilios on 2 Dec 2014
Edited: Vassilios on 2 Dec 2014
sure, this is an example (it is useless because it scales the same image but it can show the error)
>> I=imread('cameraman.tif');
>> for i=1:10, I2{i}=imresize(I,[256 NaN]); end
>> clear I2
>> parfor i=1:10, I2{i}=imresize(I,[256 NaN]); end
Out of memory. Type HELP MEMORY for your options.
while this
parfor i=1:10, I2{i}=imresize(I,[256 128]); end
works perfectly.
Note that I'm using R2014a
Edric Ellis
Edric Ellis on 2 Dec 2014
I just tried your reproduction in R2014a on WIN64 and GLNXA64, and it worked fine - what OS are you using? Does it make any difference if you open a smaller pool? I.e. try
parpool('local', 1)
When you get the error, could you try:
E = MException.last
and if E is a ParallelException (which means that the out-of-memory occurred on the workers rather than on the client), also try
getReport(E.remotecause{1})

Sign in to comment.

Answers (0)

Categories

Find more on Structures in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!