matlab高级编程之内存管理

本文档介绍了如何理解和防止MATLAB中的'Out of Memory'错误,详细讨论了虚拟内存、内存碎片、32位和64位架构的限制,以及如何通过内存管理命令如CLEAR、PACK、QUIT、SAVE和LOAD来避免内存问题。同时,提供了查看内存使用情况的方法,并指导如何调整操作系统的交换空间设置。
摘要由CSDN通过智能技术生成

熟悉memory命令

memory - Display memory information

Syntax

memory userview = memory [userview systemview] = memory

Description

memory displays information showing how much memory is available and how much the MATLAB® software is currently using. The information displayed at your computer screen includes the following items, each of which is described in a section below:

userview = memory returns user-focused information on memory use in structure userview. The information returned in userview includes the following items, each of which is described in a section below:

[userview systemview] = memory returns both user- and system-focused information on memory use in structures userview and systemview, respectively. The userview structure is described in the command syntax above. The information returned in systemview includes the following items, each of which is described in a section below:

Output

Each of the sections below describes a value that is displayed or returned by the memory function.

Maximum Possible Array

Maximum Possible Array is the size of the largest contiguous free memory block. As such, it is an upper bound on the largest single array MATLAB can create at this time.

MATLAB derives this number from the smaller of the following two values:

  • The largest contiguous memory block found in the MATLAB virtual address space

  • The total available system memory

To see how many array elements this number represents, divide by the number of bytes in the array class. For example, for a double array, divide by 8. The actual number of elements MATLAB can create is always fewer than this number.

When you enter the memory command without assigning its output, MATLAB displays this information as a string. When you do assign the output, MATLAB returns the information in a structure field. See the table below.

Command Returned in
memory String labelled Maximum possible array:
user = memory Structure field user.MaxPossibleArrayBytes

All values are double-precision and in units of bytes.

Footnotes

When you enter the memory command without specifying any outputs, MATLAB may also display one of the following footnotes. 32-bit systems show either the first or second footnote; 64-bit systems show only the second footnote:

Limited by contiguous virtual address space available.

There is sufficient system memory to allow mapping of all virtual addresses in the largest available block of the MATLAB process. The maximum amount of total MATLAB virtual address space is either 2 GB or 3 GB, depending on whether the /3GB switch is in effect or not.

Limited by System Memory (physical + swap file) available.

There is insufficient system memory to allow mapping of all virtual addresses in the largest available block of the MATLAB process.

Memory Available for All Arrays

Memory Available for All Arrays is the total amount of memory available to hold data. The amount of memory available is guaranteed to be at least as large as this field.

MATLAB derives this number from the smaller of the following two values:

  • The total available MATLAB virtual address space

  • The total available system memory

When you enter the memory command without assigning its output, MATLAB displays this information as a string. When you do assign the output, MATLAB returns the information in a structure field. See the table below.

Command Returned in
memory String labelled Memory available for all arrays:
user = memory Structure field user.MemAvailableAllArrays

Footnotes

When you enter the memory command without specifying any outputs, MATLAB may also display one of the following footnotes. 32-bit systems show either the first or second footnote; 64-bi

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值