first I would not use FldSetTextHandle while the handle is locked, but after unlock
second the handle provided is not freed by the system. you must do FldSetTextHandle(fldP,NULL); then free your handle



Joe Siebenmann wrote:


Hi All,

In my utilities, I have the 'stardard' SetFieldText() function:

void SetFieldText(FieldPtr fldP, Char * string)
{
        UInt16  size;
        MemHandle       textH;
        Char *  textP;
        
        size = StrLen((const Char *)string);
        if ( size > 0 && fldP )
        {
                size++;
                textH = MemHandleNew(size);
                if ( textH )
                {
                        textP = MemHandleLock(textH);
                        MemMove(textP, string, size);
                        FldSetTextHandle(fldP, textH);
                        
                        MemHandleUnlock(textH);
                }
        }
}

Problem is... if I turn on  'MemMgr leaks', on the 4.0 debug ROM, it
says that, every time it gets used, that there was a memory leak.

I thought the system was supposed to clean-up the memory for the text
handle when the app exits.

Is there something else I need to do? ( to make sure the memory is
free'd )  Can I 'ignore' the warning? ( it IS cleaning it up )


Thanks,


Joe Siebenmann


__________________________________ Do you Yahoo!? Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes http://hotjobs.sweepstakes.yahoo.com/signingbonus


-- Riccardo Cohen

Articque
Les Roches
37230 Fondettes
France
web = http://www.articque.com
tel: +33 02 47 49 90 49
fax: +33 02 47 49 91 49


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

Reply via email to