Hi all
I have a form that I only need to load if it meets the certain criteria..
I am using Ezula^ Ezula1 = gcnew Ezula();
And In the InitializeComponent(); I have some functions to determine if the form needs to run
if not return false.......
How do I deactive and unload the the gcnew Ezula(); from memory........
I have not done a form_load yet,,,,,,
public:Ezula(void){
InitializeComponent();
//
//TODO: Add the constructor code here
//
vasu::Glabols::Return_Boolean = Is_presoft_Installed_And_Ezula_accepted();
}
also the other question that I have is when I do do a form_load and I do a
this
->Close();does that unload and kill the form code from memory....
I need to know these things cause it will end up being a program that will run on boot up! and live in the tray........... so it needs to slim to none,,,,,,,,,
Thanks
P.S I'm playing with VS2005 PRO C++/CLI managed...............

How do I get memory back when I don't use a FORM
Nicky Chen
Hey that helps a great deal with the question on getting my mind back..
I like trick of the eye things.......
BUT BUT
When you all say don't call the form up till I need the bloody thing that I can understand tooo ......
AND MORE BUT BUT
I have to incuded a
#include
"Ezula.h"in order to call the form if need later...
Is having the include going to burn memory..... or is it just there as a reference,,,,,, till needed..........
I moved the test for if ezula is needed into the mainForm.cpp
and I have to include ezula.h or the complier crys.......
Federico Caselli
Hi,
I think I should have posted with facts and figures, I don’t know in deep but this is fact.
I created a sample application which contains two forms, Form1 and Form2.
I have Created a class variable of Form2 on Form1 so that i can play arround with it on Form1.
When my Form1 Start it loads the Form2.
I have inserted two buttons on Form1.
First name Close and 2nd's name minmize_and_close.
As from names clear that Close button just does following...
form2.Close();
And minimize_and_close do following...
form2.WindowState = FormWindowState.Minimized;
form2.Close();
Test with simple Close
Now i run my applicaiton and open the Task Manger.
In Task Manager following is the status of my application Mem Usage.
16,692 K (round about)
Now when I press close button, mean call following statement
form2.Close();
and view the status of my application Mem Usage its round about same
16,932 K (round about)
….
Test With Minimize before Close
Now I restart my application and view the status of my application Mem Usage.
Its round about same as earlier…
15,280 (round about)
Finaly I press the minimize_and_close button, means call following statement
form2.WindowState = FormWindowState.Minimized;
form2.Close();
and view the status of my application Mem Usage.
Its… 5,716 (round about) only…
Well I have not much investigated why is this but as I said I have observed it.
Test not ends here…
General Application Test
I have created a application with two forms. when it run it show the Mem Usage
16,712 K (round about) In Task Manager.
When I minimise this application it shows the Mem Usage
2,212 K (round about)
And when I maximize and work again with it it shows
4,360 K (round about) only.
So finally we can say that we will free up some memory by calling this statement, how ever this doesn't effect the VM but still it has a performance edge by reducing number of pages reside in memory.
form2.WindowState = FormWindowState.Minimized;
form2.Close();
Hope this help.
Nicolas Lehuen
You can't, you've called gcnew, there is no gcdelete, you have to rely on the garbage collector to clean it up for you. You'd do better to not call new untill you need it.
mr_snubbex
Ok thanks all!
Now it is off to post my next question.......
not related to this one
prasanna1579
OK great!
anyway for anybody else that runs across this thread
the windows min looks like this;;;;;;;;
for C++/CLI Managed
this->WindowState = System::Windows::Forms::FormWindowState::Minimized;this->Close();
LOL I cheated I Changed the form to min in the designer
then got out my glue gun!!!!!!
Thanks AGAIN!!!!!!!!!
I always get great answers from this forum...........
Robert Vis
Hi,
I have observed if you minimise the form GC free up the memory. Try this when closing.
this.WindowState = FormWindowState.Minimized;
this.Close();
Hope this helps.
oxomichael