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 Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Issuing RELEASE THISFORM really clear-up the memory ?

Status
Not open for further replies.

stvhui

Programmer
Jul 17, 2002
13
ID
Hello to you,
I'm uisng vfp7

I open all my form in :

PUBLIC frmabc
DO FORM abc NAME frmabc LINKED NOSHOW WITH "xyz"
frmabc.show

When Closing the form, I issuing :
RELEASE thisform

At the same time, I opened about 10 forms that means I also has 10 public var referenced to the form's object.

I never release the public object because until now I don't have any trick to make it in the generic way.

I said that because, actually I opened all my form in :
frm = "abc"
public (frm)
do form (frm) name (frm) linked noshow with "xyz"
&frm..show

and then I also trapped the form's keypress event :
When ESC key pressed then RELEASE thisform

My questions :
1.In sometimes I got an error message like "not enough memory" or some like this. (CPU=Pentium I-166, Memory 32 MB)
I know this old PC even though at my country INDONESIA

2. should I set the forms object to NULL

Note : All of the control I used in form is based on my control (I'd subclassed it even the form)

Please advice
Steven
 
Most likely unrelated to your problem.
May I ask why you load all your forms with a public variable and a parameter? Do you refer to functions from form to form, that you would need a variable reference?
 
It would be a good idea to release any var when finished with it. Also, you don't need to use keypress event to release form in esc. Set your exit button prperty Cancel to .t.. this will do the same thing. Attitude is Everything
 
stvhui

As mgagnon has commented, unless you are referencing a form from another object, there is no point in using the NAME argument with DO FORM.

Equally, I would suggest you do not need a PUBLIC variable for the name unless, by design or experience, you find the name going out of scope.

If you put RELEASE formname, (the name variable for the form), in the Unload() event of each form, you will be removing all references to the object, which is the answer to your original question.

If you are not using the NAME argument, then THISFORM.Release() will also clear the references.

From a naming convention point of view, and this is a matter of style and personal preference, I would suggest you prefix any object created with 'o', so

DO FORM FORM1 NAME oForm1 LINKED

clearly indicates to you or anyone else working on your project, that oForm1 is the object reference to FORM1. HTH

Chris [pc2]
 
stvhui

To avoid any confusion THISFORM.Release() should not be in the .Unload() event of the form, which is one way you might have understood that particular paragraph. HTH

Chris [pc2]
 
Steven,
Unfortunately you are going to have problems with only 32MB - this doesn't even meet the base required specifications for VFP 7.0 (not to mention the recommended ones). I wouldn't consider developing (or running an application) on VFP 7.0 with less than 500 mHz, and 128MB RAM. Do whatever you can to get more memory - if your company can afford VFP 7.0, they can afford better hardware.

Rick
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top