You need to follow a couple of simple rules:
1. Always declare your vars as LOCAL as much as possible. Especially vars containing object reference.
2. Set the variables containing object reference to NULL as soon as your are done with the object. There is no need to release the variables if they are set as local.
3. This is the most important rule: Make sure ALL properties of an object containing an object reference are set to null before destroying the object. If not, you you will end up with dangling object references and ultimatly get C5s.
Dangling object references can be very tricky and you never know when the C5 will append, i've seen it append anywhere in the code where the line of code where the C5 append is not the cause of the C5. C5 is NOT a VFP error, it is thrown by the O/S when a memory access violation occurs.
>You are suggesting me to do this ???
>
>--------------------------------------------------
>local ln_counter
>local lc_lastname
>use freetable
>count to ln_counter
>go bottom
>lc_lastname = freetable.clientname
>use
>....
>....
>....
>release ln_counter
>release lc_lastname
>--------------------------------------------------
>
>Is it Ok ? Is it what you saying me to do ?
>Release manually my local variables after use it ???
>
>[]s Moshe.
Précédent
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement