Message Boards Message Boards

GROUPS:

Possible Bug: Memory leakage when exporting “.mov” files

Posted 3 months ago
430 Views
|
3 Replies
|
5 Total Likes
|

I have posted this problem a week ago on Stack Exchange, and it seems like a system dependent bug or something. I have reported this to Wolfram Support but I get no response, so I think maybe I should post the problem here. Below is the description:

I am using Mathematica 11.3 with Windows 10.

When calling Export to export a List of Images as a QuickTime movie, the memory used by Mathematica 11.3 increases but it is not released after the evaluation. The code below is a simple example:

$HistoryLength = 0;
frame = Rasterize[Plot[x, {x, 1, 2}], RasterSize -> 1000, ImageSize -> {960, 720}];
frame = Table[frame, {i, 100}];
Export["D:\\example.mov", frame, "FrameRate" -> 100];

After runing this Cell, open Task Manager to check how much memory Mathematica is using. On my PC, it shows that Mathematica is using 769.0MB memory. Then run the Cell below:

Export["D:\\example.mov", frame, "FrameRate" -> 100];
MemoryInUse[]/1024.^2

Now Task Manager shows that Mathematica is using 1055.4MB memory, while Mathematica 11.3 shows that the memory in use in MB is:

91.6286

If you run the second Cell for more several times, the number in Task Manager keeps increaing but the number in Mathematica does not change obviously.

This problem is forcing me to restart the kernal everytime i export a lots of images as a QuickTime video.

3 Replies
  • You may use avi format to export, which is memory-leak proof. avi is natively supported on Windows system:

    Export["test.avi", frame, "FrameRate" -> 100];
    
  • I am surprised that mov even works on windows. According to ImportExport Developer Guide, there must be a folder like

    "DIR\SystemFiles\Formats\<format-name>"
    (* DIR is $InstallationDirectory, $UserBaseDirectory or $BaseDirectory *)
    

    to support Import/Export of <format-name> in a Mathematica session. For instance, avi format support is found at

    "C:\Program Files\Wolfram Research\Mathematica\11.3\SystemFiles\Formats\AVI"
    

    I have not found the corresponding directory for mov format.

Posted 3 months ago

Yes, avi can solve the memory leakage problem on Windows, but the file it creates would be uncompressed and really huge. It seems like that exporting the file as mov can solve the huge file problem, and that is why i export a mov file on Windows.

i have also tried with Version 10.4 on windows, and it can create mov file without any problem though the same code would produce file with different size by 11.3 and 10.4. I think this is because the codec Mathematica uses in 10.4 is not H.264.

This memory leak will be fixed in version 12.0. In 11.3 you can use animated GIF or PNG.

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract