Jump to content
Sign in to follow this  
Czar

Freeing objects?

Recommended Posts

Obviously in Delphi when you create objects you need to free them.

e.g.,

  var ButtonInstance := tNWButton.create(50, 50, 'test');
  FButtons.add(ButtonInstance);

In Delphi I would free the objects in the form.onclose;


  while FButtons.Count>0 do
    begin
      FButtons[0].free;
      FButtons.Delete(0);
     end;

My question, is that a requirement in SMS? What are the consequences of not freeing objects in the case of a webpage? 

 

Share this post


Link to post
Share on other sites

The parent of a control will always release the child elements.

So you dont have to release buttons added to a toolbar for example.

When writing custom-controls however, it is good practice to clean up in the FinalizeObject() method.

But the container control at the root of the RTL will clean up any lingering components that exists on a control.

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×