I'd recommend moving the MemHandleUnlock line to after the DmReleaseRecord
line.  Also, sine you're releasing the record as dirty, you should have a
DmWrite prior to releasing the record.

BTW, what is the relation between 'RestartPrep.recordNumber' and
'recordNumber'?  You reference one of them when you read the record, and the
other when you release it..?



on 9/19/01 9:07, Johnathan Smith at [EMAIL PROTECTED] wrote:

> Each Time I try to update my database with the
> following code I get a memory error
> 
> ----- Source Code ------
> static void saveCurrentRec()
> {
> DmOpenRef   dbRef;
> dbRef = OpenRecordDatabase(appDatabase,
> appFileCreator, appDatabaseType);
> 
> MemHandle h = DmGetRecord( dbRef,
> RestartPrep.recordNumber);
> RecDetails *rec = (RecDetails *) MemHandleLock(h);
> 
> rec->name = RestartPrep.name;
> rec->age = RestartPrep.age;
> 
> MemHandleUnlock( h );
> DmReleaseRecord( dbRef, recordNumber, true );    
> 
> DmCloseDatabase(dbRef);  
> }
> 
> 
> __________________________________________________
> Terrorist Attacks on U.S. - How can you help?
> Donate cash, emergency relief information
> http://dailynews.yahoo.com/fc/US/Emergency_Information/


-Tom Hoelscher

~~~~~~~~~~~~~~~~~~~~~~~~~~
"Original Sin is hard to find, but the digitally enhanced version is readily
available".


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

Reply via email to