DestroyLayout destroys a layout and all its contents so it can't be used any more.
As a result, all memory occupied by these objects will be released.
See Also: CreateLayout, AddLayout
Example - Destroy layout and check if deleted
function OnStart()
{
lay = app.CreateLayout( "linear", "VCenter,FillXY" );
btn = app.CreateButton( "Don't Press Me", 0.3, 0.1 );
btn.SetOnTouch( btn_OnTouch );
lay.AddChild( btn );
app.AddLayout( lay );
}
function btn_OnTouch()
{
app.DestroyLayout(lay);
var text = this.GetText() || "nothing in here!";
app.ShowPopup(text);
}