Jump to content

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? 

 

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.

 

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...