Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
BUG - Exception code=C0000005
Message
 
To
22/03/2003 05:40:17
Mauricio Marques
Moshe & Bottmann Associados
São Paulo, Brazil
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00766931
Message ID:
00768893
Views:
24
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.
Previous
Reply
Map
View

Click here to load this message in the networking platform