Search Mailing List Archives

Limit search to: Subject & Body Subject Author
Sort by: Reverse Sort
Limit to: All This Week Last Week This Month Last Month
Select Date Range     through    

[farmshare-discuss] Matlab imread memory leak while reading JPEG2000 images

Alex Chekholko chekh at
Tue Jul 24 23:19:59 PDT 2012


I can confirm that the memory keeps growing similarly when using MATLAB 
R2012a on FarmShare.

I don't think we're going to do anything about it.


On 7/24/12 5:22 PM, Pierre Martineau wrote:
> It looks like there is a memory leak in the Matlab imread function when reading lossless JPEG2000 files; the problem is easily reproduced by running the test program below on corn with the current Matlab version (Release 2011b).  The loop shows the virtual memory growing; kept unbound, Matlab ends up crashing.  Clearing the memory at each iteration using any flavor of "clear" has no effect.  I believe this problem may be related to an alleged Sun JAI bug reported at
> Pierre
> %grab pid of current MATLAB process to monitor memory consumption
> [~, matlabPid] = unix('pidof MATLAB | grep .$');
> matlabPid = strtrim(matlabPid);
> %create large (45M) jpeg2000 file
> img = uint8(rand(5000, 3000, 3)*225);
> tmpName = [tempname '.jp2'];
> imwrite(img, tmpName, 'Mode', 'lossless');
> imgInfo = imfinfo(tmpName);
> disp(imgInfo.FileSize);
> %iterate reading the same file and monitor virtual memory size
> jp2 = imformats('jp2');
> for i=1:100
>      feval(, tmpName);
>      [~, VmData] = unix(['grep VmData: /proc/' matlabPid '/status | awk ' char(39) '{print $2}' char(39)]);
>      disp(VmData);
> end
> %clean up
> delete(tmpName);
> _______________________________________________
> farmshare-discuss mailing list
> farmshare-discuss at

Alex Chekholko chekh at 347-401-4860

More information about the farmshare-discuss mailing list