This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[参考译文] CCS/OMAP-L138:内存严重泄漏

Guru**** 2555630 points


请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/processors-group/processors/f/processors-forum/610428/ccs-omap-l138-big-memory-leak

器件型号:OMAP-L138

工具/软件:Code Composer Studio

大家好、

我的程序所在的 ompl138上的存储器存在一系列问题。

#include
#include

int main()

文件*fil;
int *var1、*var2、*var3;
int *data=(int *) malloc (1*sizeof (int));
*data=5;
file=fopen ("data.txt"、"w+");
VAR1=(int *) malloc (1*sizeof (int));
*var1=5;
if (fwrite (data、sizeof (int)、1、file)!=1)

   printf ("错误文件");


VAR2=(int *) malloc (1*sizeof (int));//地址在0xc0000138中非常远
*var2=3;
fclose (文件);
VAR3=(int *) malloc (1*sizeof (int));//也是正常的
*var3=7;;
返回0;


VAR1:0xc0000018

Var2:0xc0000138

Var3:0xc0000028

为什么 var2被分配到非常远的内存中、而这个内存全部消失了?
这是否正常? fwrite 是否使用堆?

我正在使用 ccsv5.5仿真器上传文件、请访问 help.e2e.ti.com/.../4336.test.rar

此致、

elmenshawy

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好!

    您运行的是哪种操作系统? RTOS 还是 Linux?  

    此致、
    Yordan

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
    您好!

    我使用的是 OS Linux。

    请告诉我这两种情况(RTOS 或 Linux)是什么情况?

    此致、
    Ahmed
  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
    您好、Ahmed、

    我不是 RTOS 专家。
    关于 Linux 方面、您能否尝试使用提供的 gcc 工具链交叉编译程序、并查看结果是否相同?

    在给定您的 cmd 文件的情况下、我认为 var1/2/3的分配是正确的。

    此致、
    Yordan