Delphi Android Memory Leak(or another slowdown) -


I'm opening a new look, it's getting slower each time it's open. I do freeze, Free, Release, Dispose but do not attempt the solution. I added a standby timer:

button 1 first click, 0,18 seconds after form 2 show

button 1 second click, after form 2 show 020 seconds < / P>

Button 1 Third Click, 0 After Show 2, 23 Seconds

Button 1 Fourth Click, 0,28 seconds after Form 2 Show . .

Click the button 1xxxx, 6, 30 seconds after the form 2 show

Click on Form 1 button 1. Application.CreateForm (TFrom2, Form2); Form2.Show; // Form 2 Ouncle: // I try // Free AndNil, Free, Recesses, Dispos ... ...

How to solve it? Sample Project Source:

Click on "Form 2 Show Button" Try to multiply 20-30. Increase wait time in the memo

Well, I messed up my project a little bit and it worked, but There are a lot of things that you normally do in comparison to the program.

For starters, when you want to use a mobile to settle a form. See specifically:

There are scenarios when you need to execute an instant-destroying code, regardless of the fact that there may be other pending references to the object. .] The new compiler introduces a settlement pattern: MyObject.DisposeOf ;

One more thing I noticed was that your unit 3 forms 4. But then you have access to Memo in Unit 4 Unit 3. I hope that only demo is for purposes because I do not think such design has been suggested.

So, how did I get to do this work, short summary: I have a TNotifyEvent when it is completed in Form 4:

  Process TForm4.Button1Click (Sender: Tubbed); If assigned, start (FoncelloEvent) then FoncoloEvent (self); End;  

In Uni3, I set up a handler when the form is created:

  MyForm. OnCloseEvent: = CloseEvent;  

Event triggers this code:

  Process TForm3.CloseEvent (Sender: Tubect); If it is fixed then (myform) then my farm. End;  

I have also created a personal object of MyForm against the local variable TForm3 .

With these changes as long as I want, I can hit the show and show the form as soon as possible. There can be better ways to do this, if I have come to know!


Comments