I have 16 GB of RAM, why can't I load a 3.5 GB file?
5 次查看(过去 30 天)
显示 更早的评论
Hi,
I'm trying to load a video file containing thermal imaging data with a resolution of 512x640 pixels and 6000 frames.
For that reason, I want to preallocate a matrix of data type uint16, 512x640x6000 entries big.
However, Matlab tells me it runs out of memory with those settings.
Typing memory in the command line tells me the following:
Maximum possible array: 10367 MB (1.087e+10 bytes) *
Memory available for all arrays: 10367 MB (1.087e+10 bytes) *
Memory used by MATLAB: 1758 MB (1.843e+09 bytes)
Physical Memory (RAM): 16319 MB (1.711e+10 bytes)
* Limited by System Memory (physical + swap file) available.
So I don't get why I can't create that matrix. I should have more than enough memory just in RAM, not even counting swapping space on the hard drive.
Can anyone tell me how I can get that file loaded?
Thanks in advance.
2 个评论
Stephen23
2020-3-19
" I want ot preallocate a matrix of data type uint16, 512x640x6000 entries big"
Exactly how did you try to do that? Please show the exact code you tried.
采纳的回答
Stephen23
2020-3-19
编辑:Stephen23
2020-3-19
This line has very inefficient use of memory, and is likely the cause of the error:
video=uint16(zeros(zeilen,spalten,frames));
The zeros call creates a double array (not an integer array) with the requested size, which will not fit in your memory. Its author intended that after it is created it should be converted to integer by uint16: it is a very inefficient use of memory to create a large double array which would only exist for a moment before being converted to integer and then simply discarded. In case you were curious, its size in memory would be:
>> 512*640*6000 * 64/8 % bytes
ans = 1.5729e+10
which is clearly larger than your maximum permitted array size. The solution is very simple:
video = zeros(zeilen,spalten,frames,'uint16');
which will have size in memory:
>> 512*640*6000 * 16/8 % bytes
ans = 3.9322e+09
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!