# Deleting vars local to a function in a class

**URL:** <https://forum.kirupa.com/t/deleting-vars-local-to-a-function-in-a-class/217923>\
**Category:** Uncategorized\
**Created:** [March 2, 2007, 10:50pm UTC](https://forum.kirupa.com/t/deleting-vars-local-to-a-function-in-a-class/217923 "2007-03-02T22:50:52Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![creatify](https://avatars.discourse-cdn.com/v4/letter/c/d07c76/32.png) [@creatify](https://forum.kirupa.com/u/creatify)\
**Post date:** [March 2, 2007, 10:50pm UTC](https://forum.kirupa.com/t/deleting-vars-local-to-a-function-in-a-class/217923/1 "2007-03-02T22:50:52Z")

</div>

Is there any advantage to deleting vars instantiated within public or private functions in a class, or are they removed from memory after the function has been invoked/run? The function below is completely arbitrary for example:

```
 ActionScript Code:
 [FONT=Courier New][LEFT][COLOR=#0000ff]private[/COLOR] [COLOR=#000000] **function** [/COLOR] someFunctionHere[COLOR=#000000]([/COLOR]_ar:[COLOR=#0000ff]Array[/COLOR][COLOR=#000000])[/COLOR]:[COLOR=#0000ff]Void[/COLOR] [COLOR=#000000]{[/COLOR]
    [COLOR=#000000] **var** [/COLOR] _swf:[COLOR=#0000ff]String[/COLOR] = _ar[COLOR=#000000][[/COLOR][COLOR=#000080]0[/COLOR][COLOR=#000000]][/COLOR];
    [COLOR=#000000] **var** [/COLOR] _nm:[COLOR=#0000ff]String[/COLOR] = _ar[COLOR=#000000][[/COLOR][COLOR=#000080]1[/COLOR][COLOR=#000000]][/COLOR];
    [COLOR=#000000] **var** [/COLOR] _num:[COLOR=#0000ff]Number[/COLOR] = [COLOR=#000080]5[/COLOR];
    
    [COLOR=#808080]*//use them here*[/COLOR]

    [COLOR=#0000ff]delete[/COLOR] _swf;
    [COLOR=#0000ff]delete[/COLOR] _nm;       
    [COLOR=#0000ff]delete[/COLOR] _num;

```

[COLOR=#000000]}[/COLOR]  
[/LEFT]  
[/FONT]
