Yes I agree but how can I correct this error, please.

here is again my code:

                     //to count all records in my database
        errCPDB = CPDB_CompterEnregistrement(Record,&numItems);

                     //I go to the first record
        errCPDB = CPDB_LirePremier(Record);

        for (i=0;i<numItems;i++)
        {
                                           //I read a field in my database
                CPDB_LireEntier(Record,"ID", &val);
                if (val==IDPerson)
                {
                        nbItems++;
                }
                                          //To go to the next record
                                          CPDB_LireSuivant(Record);
        }

                     //I allocate itemList for the number of Items
        itemList = (Char **) MemPtrNew(nbItems * sizeof(Char *));
        gListHistorique=itemList;
        gListHistoriqueNumItems = nbItems;

        errCPDB = CPDB_LirePremier(Record);
        ErrFatalDisplayIf(errCPDB!=0,"impossible de lire le record");

        for (i=0; i<numItems;i++)
        {
                CPDB_LireEntier(Record,"ID", &val);
                if (val==IDPerson)
                {
                                                                //I read the String I 
want to show in the list
                        CPDB_LireChaine(Record, "EVENT", &hHeure);
                        chrTemp = (Char*)MemHandleLock(hHeure);

                        sizeOfRec = StrLen(chrTemp) + 1;
                        itemList[i] = (Char*)MemPtrNew(sizeof(Char) * sizeOfRec );
                        StrCopy(itemList[i],chrTemp);
                        MemHandleUnlock(hHeure);
                        MemHandleFree(hHeure);
                        hHeure = NULL ; // Not required to be done but still
                }
                CPDB_LireSuivant(Record);
        }

        LstSetListChoices(lst, itemList, nbItems);

        LstDrawList(lst);

Regards,

Helene

> Then chances are you are misallocating memory for either itemList or
> charTemp.  More than likely, itemList points to invalid memory or not
> enough.
>
> ----- Original Message -----
> From: <[EMAIL PROTECTED]>
> To: "Palm Developer Forum" <[EMAIL PROTECTED]>
> Sent: Tuesday, September 24, 2002 5:41 AM
> Subject: Re: Memory problem
>
>
> When I use the CodeWarrior debugger, it stops on :
> StrCopy(itemList[i],chrTemp);
>
> Greets
>
> Helene
>
>
> > Hey,
> >
> > when you use the debugger of your developement-environment it should point
> to the
> > line that causes the error! What do you use?
> > www.falch.net sells a very good one and you can download a trial first ...
> >
> > Greets
> > SL
> >
> > On 24 Sep 2002 at 10:47, [EMAIL PROTECTED] wrote:
> >
> > > Hello,
> > >
> > > I have a problem with my program : "MyAplli just wrote to memory
> location 0x0003AC74, which is in Memory Manager data Structures".
> > >
> > > It seems it is a memory problem but I don't know where. Here is my code:
> > >
> > > [...]
> > >
> > > Where there is CPDB it is just some things to use DataBase.
> > >
> > > if you have an answer, I have passed 3 days on it and I don't know where
> there is a problem.
> > >
> > > Thanks,
> > >
> > > Helene
> >
> > --
> > For information on using the Palm Developer Forums, or to unsubscribe,
> please see http://www.palmos.com/dev/support/forums/
> >
> ------------------------------------------
>
> Faites un voeu et puis Voila ! www.voila.fr
>
>
> --
> For information on using the Palm Developer Forums, or to unsubscribe,
> please see http://www.palmos.com/dev/support/forums/
>
>
>
>
> --
> For information on using the Palm Developer Forums, or to unsubscribe, please see 
>http://www.palmos.com/dev/support/forums/
>
------------------------------------------

Faites un voeu et puis Voila ! www.voila.fr


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

Reply via email to