Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Releasing public variables

Status
Not open for further replies.

mdav2

Programmer
Aug 22, 2000
363
GB
I have an old system that uses the "display memory" command to send the contents of the memory to a text file. However, there are several large arrays and after the text file is created the system errors with a General Protection Fault.

I know I can close these publick variables down with a "release x" command where x is the name of the variable. The arrays are all prefixed "ga" so I hoped to just use a "release all like ga*". This doesn't work because release all only works on variables that are private.

I am stuck for ideas now, anyone suggest a way of tackling this? I was hoping for a way of looping through a collection but that isn't an option in foxpro.

Thanks in advance.

Rewriting this in VFP 9 is not an option, otherwise this wouldn't be a problem.

Mark Davies
Warwickshire County Council
 
Can you use the EXTENDED clause of RELEASE ALL to make it work? (Be aware that you can't combine EXTENDED and LIKE, though.)

Tamar
 
One other thought. Could you change the arrays to be private instead of public? There's really not much you can do with a public variable that doesn't work with private.

Tamar
 
I came up with a solution that might work. I am going to create a temporary table when the application starts and write the name of all public arrays created to it. When the error handler is triggered check for the existence of the table and loop through the variables releasing them one by one. I haven't tried this yet so I might fall flat on my face but it's the only I can think to keep the other variables that will be of use during debugging and error fixes.

Mark Davies
Warwickshire County Council
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top