Durgesh,
Well that's really interesting (to me anyway)...
The only way I can find to get rid of the error just really doesn't make
sense to me.
Maybe somebody else can tell me why this works, any other combination
produces a FATAL alert on exit from the app.
The exact message is "systemmgr.c, Line:4397, Minor error while exiting
app: un-freed chunk at 0x00F793E0, size 33 (ownerID 2)",
though the size varies depending on whether you call FrmCloseAllForms()

The call to MemPtrFree( dbListIDsP) (as Durgesh rightly says) is
necessary
to free the memory allocated by the earlier call to
SysCreateDataBaseList() a System call! Why?

But that on it's own is not enough...I had to add a call to
FrmCloseAllForms() in the AppExit() function to make this error go
Away completely.

So, Durgesh, try putting a call to FrmCloseAllForms() in your AppExit()
function and let me know how you get on.

As an aside, you shouldn't be freeing the memory that the list can see
until you're completely done with the list, so I'd still go with
Some cleanup function when you know it's safe to do so, like at form
close as you suggested.

Regards
John Sutton


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Durgesh
Trivedi
Sent: 12 September 2006 14:19
To: Palm Developer Forum
Subject: RE: List draw error

I am wrking on pods 4 garnet 5.4 simulator on the eclipse 3.0.1  i also
try to write the  memory free code at frm close event it also not wrk.

static void TodayPreference(FormType* frm) { 
SysDBListItemType          *dbListIDsP; 
MemHandle                  dbListIDsH; 
static UInt16              dbCount = 0; 
UInt16 counter; 
Boolean                    status;                 
ListType*  lst;
static char **ItemType; 
 
       
   
     
    if(ItemType)
       {
                 for(counter=0;counter<dbCount;counter++)
                        {
                                MemPtrFree(ItemType[counter]);
                        }
                        MemPtrFree(ItemType);
                        dbCount=0;
                }
                if(frm)
                {
                    
           status = SysCreateDataBaseList(sysFileTApplication,
0,&dbCount, &dbListIDsH,true); 
           ItemType = (Char**)MemPtrNew(dbCount * sizeof(Char*)); 
        
           dbListIDsP = (SysDBListItemType*)MemHandleLock (dbListIDsH); 
     if (status == true && dbCount > 0)   
       { 
        for (counter = 0; counter < dbCount; counter++) 
          {              
                   ItemType[counter] =
(Char*)MemPtrNew(dmDBNameLength+1);                
                        StrCopy(ItemType[counter],
dbListIDsP[counter].name);

          }    
           
            lst = (ListType*)FrmGetObjectPtr(frm,FrmGetObjectIndex(frm,
TodayPrefList));     
            LstSetListChoices (lst,ItemType,dbCount);
          
           MemHandleUnlock(dbListIDsH);          
                   MemPtrFree( dbListIDsP);                      
       } 
     }
  }
if i use the MemPtrFree( dbListIDsP);  it decrease the memory lick to 33
else it give the size as 780 which is due to ItemType =
(Char**)MemPtrNew(dbCount * sizeof(Char*));
--
For information on using the PalmSource Developer Forums, or to
unsubscribe, please see http://www.palmos.com/dev/support/forums/

______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email
______________________________________________________________________

______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
______________________________________________________________________

-- 
For information on using the PalmSource Developer Forums, or to unsubscribe, 
please see http://www.palmos.com/dev/support/forums/

Reply via email to