# GarbageCollection - is this safe?

**URL:** <https://forum.kirupa.com/t/garbagecollection-is-this-safe/269005>\
**Category:** flash\
**Created:** [August 21, 2008, 11:52am UTC](https://forum.kirupa.com/t/garbagecollection-is-this-safe/269005 "2008-08-21T11:52:22Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![oybrator](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/oybrator/32/1384_2.png) [@oybrator](https://forum.kirupa.com/u/oybrator)\
**Post date:** [August 21, 2008, 11:52am UTC](https://forum.kirupa.com/t/garbagecollection-is-this-safe/269005/1 "2008-08-21T11:52:22Z")

</div>

Hi!

I was just wondering if anyone could comfirm of this is OK with regards to garbage collection. As you can see, the timer is local (and has limited repeatCount) and the listener is anonymous and the listener is weak.

```auto
protected function _flashErrorField():void
{
	var t:Timer = new Timer(250, 4);
	t.addEventListener(TimerEvent.TIMER, function():void{_errorField.visible = !_errorField.visible;}, false, 0, true);
	t.start();
}

```
