?
Solved

form load unload /memory management

Posted on 1999-10-04
9
Medium Priority
?
390 Views
Last Modified: 2010-04-06
I hawe application with many forms which using graphics and large data array
I hawe following question can I load form before i wont to use it and after that to unload it from memory so i can manage my memory resources ?
Form shold be later aviable for load / unload again


I'm not sure how delphi manage memory resources so I'm affraid if i write to many forms with larege memory request's it can slow down my app

Das show/hide relase memory which form use ?

Regards
0
Comment
Question by:monster2
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
  • +2
9 Comments
 

Author Comment

by:monster2
ID: 2096046
Is better method to borke programs in separate exe which can call each other ?
If so how can I transfer variables betwean exe files (not using some sort of temp temp files)
0
 
LVL 7

Expert Comment

by:RBertora
ID: 2096096
Show hide does not release memory..

You have to use CreateForm, and From1.Free for
propery memory management.

Rob ;-)
0
 
LVL 15

Accepted Solution

by:
simonet earned 120 total points
ID: 2096106
What you can do is:

- From the Project -> Options -> Forms, remove all but the main form and datamodules from the AutoCreate list of forms. Only leave there the forms you REALLY need at your applications's startup.

- Now, in order to create a form at runtime, add the unit where the form is to the implementation's uses clause of the unit that must create that form.

To have form1 Create and destroy form2, you'll have this scenario:

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls;

type
  TForm1 = class(TForm)
    Button1: TButton;
    Button2: TButton;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

uses Unit2;

{$R *.DFM}

procedure TForm1.Button1Click(Sender: TObject);
begin
      Form2 := TForm2.create(application);
  form2.show; { or Form2.showmodal... up to you }
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
      Form2.close;
end;

end.


Yours,

Alex



0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 12

Expert Comment

by:rwilson032697
ID: 2096117
Of course, you would also add Action := caFree in the OnClose event of the dynamically created form, or call Form2.Release to destroy the form. :-)

Cheers,

Raymond,
0
 
LVL 12

Expert Comment

by:rwilson032697
ID: 2096118
Of course, you would also add Action := caFree in the OnClose event of the dynamically created form, or call Form2.Release to destroy the form. :-)

Cheers,

Raymond,
0
 
LVL 15

Expert Comment

by:simonet
ID: 2096131
Right!

Monster2, as long as you free the other forms before creating them again, you can create and destroy them as many times as your want.

Alex
0
 

Author Comment

by:monster2
ID: 2096163
If i stuck again with this i know where to cry for help

Thanks people & regards

0
 

Author Comment

by:monster2
ID: 2096173
If i stuck again with this i know where to cry for help

Thanks people & regards

0
 
LVL 1

Expert Comment

by:Moondancer
ID: 6859072
This question was awarded, but never cleared due to the JSP-500 errors of that time.  It was "stuck" against userID -1 versus the intended expert whom you awarded.  This corrects the problem and the expert will now receive these points; points verified.

Please click on your Member Profile and select "View Question History" to navigate through any open or locked questions you may have to update and finalize them.  If you are an EE Pro user, you can also choose Power Search to find all your open questions.

This is the Community Support link, if help is needed, along with the link to All Topics which reflects many TAs recently added.

http://www.experts-exchange.com/jsp/qList.jsp?ta=commspt
http://www.experts-exchange.com/jsp/zonesAll.jsp
 
Thank you,
Moondancer
Moderator @ Experts Exchange
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Suggested Courses

719 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question