2

我问这个问题是因为我自己没有解决它,希望有人能给我任何建议。

我的问题是:

我的程序包括 3 个部分:

part-1: video encoder, 
part-2: channel coding - also call to a mex-files: complie from C-function "encodeBits.c" to Matlab-mexfile "encodeBits.mexw32", 
part-3: video decoder.

我还执行 4 项检查:

检查1:part-1 + part-2作为一个整体。这意味着没有通道编码,程序运行良好。

检查 2:对 part-2 的伪输入,这意味着part-2 保持独立。第 2 部分效果很好。

part-2 still works well even under this condition:
                possible array:             **632** MB (6.623e+08 bytes) *
                Memory available for all arrays:   **1054** MB (1.105e+09 bytes) **
                Memory used by MATLAB:              653 MB (6.842e+08 bytes)
                Physical Memory (RAM):             2795 MB (2.930e+09 bytes)

检查3:part-1 + part-2 + part-3作为一个整体。

    memory before part 1 runs:
        Maximum possible array:             877 MB (9.199e+08 bytes) *
        Memory available for all arrays:   1265 MB (1.326e+09 bytes) **
        Memory used by MATLAB:              441 MB (4.628e+08 bytes)
        Physical Memory (RAM):             2795 MB (2.930e+09 bytes)
    memory before part-2 runs, means after part-1 finished:
        Maximum possible array:             **869** MB (9.107e+08 bytes) *
        Memory available for all arrays:   **1270** MB (1.332e+09 bytes) **
        Memory used by MATLAB:              430 MB (4.511e+08 bytes)
        Physical Memory (RAM):             2795 MB (2.930e+09 bytes)
    and it results error right after part-2 starting with error
        Error using encodeBits
        Out of memory. Type HELP MEMORY for your options.

检查 4:在清除检查 3 中的所有变量后再次单独尝试第 2 部分它仍然导致错误

        Error using encodeBits
        Out of memory. Type HELP MEMORY for your options.

检查5:关闭Matlab窗口,打开Matlab窗口并单独运行第2部分 效果很好。

所以,我不明白它为什么会发生,我试图努力搜索,但我仍然无法解决它。

4

1 回答 1

0

根据您在 mex 调用时/之后的负载检查失败以及使用 clear all 不修复它来判断,听起来您的 mex 代码中有内存泄漏。如果 mexFunction 分配内存并且不清除它,matlab 无法清除空间,因此它将保持分配状态,直到您关闭 matlab。

于 2013-03-27T21:48:06.343 回答