BREW处理错误:module failed to free all memory

来源:互联网 发布:天互数据怎么样 编辑:程序博客网 时间:2024/05/22 17:29

昨晚测试小程序,遇到 module failed to free all memory,网上找了很久,没找到具体解决方法,自己试了很多次,终于解决了=。=

修改前的程序;

static boolean HelloWorld_HandleEvent(AEEApplet * pMe, AEEEvent eCode, uint16 wParam, uint32 dwParam)

{ 

       AECHAR *szText;

       uint32 textsize;

       ISHELL_GetResSize(pMe->m_pIShell,HELLOWORLD_RES_FILE,HELLOWORLD,RESTYPE_STRING,&textsize);

       szText=(AECHAR *)MALLOC(textsize);

     ISHELL_LoadResString(pMe->m_pIShell,HELLOWORLD_RES_FILE,HELLOWORLD,szText,textsize);

                   

   switch (eCode){

      case EVT_APP_START: 

 

         IDISPLAY_DrawText(pMe->m_pIDisplay,    // Display instance

                           AEE_FONT_BOLD,       // Use BOLD font

                           szText,              // Text - Normally comes from resource

                           -1,                  // -1 = Use full string length

                           0,                   // Ignored - IDF_ALIGN_CENTER

                           0,                   // Ignored - IDF_ALIGN_MIDDLE

                           NULL,                // No clipping

                           IDF_ALIGN_CENTER | IDF_ALIGN_MIDDLE);      

         IDISPLAY_Update (pMe->m_pIDisplay);

FREE(szText);

                     return(TRUE);

 

运行结束后总显示module failed to free all memory

修改后的程序:

 

static boolean HelloWorld_HandleEvent(AEEApplet * pMe, AEEEvent eCode, uint16 wParam, uint32 dwParam)

{ 

       AECHAR *szText;

       uint32 textsize;

      

                   

   switch (eCode){

      case EVT_APP_START: 

ISHELL_GetResSize(pMe->m_pIShell,HELLOWORLD_RES_FILE,HELLOWORLD,RESTYPE_STRING,&textsize);

       szText=(AECHAR *)MALLOC(textsize);

              ISHELL_LoadResString(pMe->m_pIShell,HELLOWORLD_RES_FILE,HELLOWORLD,szText,textsize);

         IDISPLAY_DrawText(pMe->m_pIDisplay,    // Display instance

                           AEE_FONT_BOLD,       // Use BOLD font

                           szText,              // Text - Normally comes from resource

                           -1,                  // -1 = Use full string length

                           0,                   // Ignored - IDF_ALIGN_CENTER

                           0,                   // Ignored - IDF_ALIGN_MIDDLE

                           NULL,                // No clipping

                           IDF_ALIGN_CENTER | IDF_ALIGN_MIDDLE);      

         IDISPLAY_Update (pMe->m_pIDisplay);

FREE(szText);

                     return(TRUE);

问题解决。

原创粉丝点击