# Safety of using throwaway FTimerHandles

**URL:** <https://forums.unrealengine.com/t/safety-of-using-throwaway-ftimerhandles/2477977>\
**Category:** C++\
**Tags:** unreal-engine, question, CPP\
**Created:** [April 27, 2025, 7:32am UTC](https://forums.unrealengine.com/t/safety-of-using-throwaway-ftimerhandles/2477977 "2025-04-27T07:32:19Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mectorn](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@mectorn](https://forums.unrealengine.com/u/mectorn)\
**Post date:** [April 27, 2025, 7:32am UTC](https://forums.unrealengine.com/t/safety-of-using-throwaway-ftimerhandles/2477977/1 "2025-04-27T07:32:19Z")

</div>

In my project one function needs to call another after a certain delay. One problem is that it’s possible I’ll need to call the first function multiple times even before the first timer executes so if I had only one FTimerHandle, it would be overwritten every time I call the function. Is using a throwaway FTimerHandle safe? Is it possible that it won’t get deleted after the timer execution that would result in a memory leak? Is there a better solution for handling this situation?

Minimal example what I want to make

```auto
void MainFunction()
{
   for(int i = 1; i < 10; i++)
   {
      Foo(i);
   }
}

void Foo(float Duration)
{
    FTimerHandle _;
    GetWorld()->GetTimerManager().SetTimer(_, this, &AThisActor::Bar, Duration, false);
}

void Bar()
{
   Do smth;
}

```

---

<div class="post-metadata">

**Author:** ![KaidoomDev](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/kaidoomdev/32/977996_2.png) [@KaidoomDev](https://forums.unrealengine.com/u/KaidoomDev)\
**Post date:** [April 27, 2025, 1:19pm UTC](https://forums.unrealengine.com/t/safety-of-using-throwaway-ftimerhandles/2477977/2 "2025-04-27T13:19:44Z")

</div>

It is generally safe the way you’re using it, the only time it’s not safe is when using a lambda because the timer does not get cleared with the actor being destroyed so need that handle to clear it.

In your example each timer will trigger at the indicated time and is independent.

---

<div class="post-metadata">

**Author:** ![mectorn](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@mectorn](https://forums.unrealengine.com/u/mectorn)\
**Post date:** [April 27, 2025, 1:43pm UTC](https://forums.unrealengine.com/t/safety-of-using-throwaway-ftimerhandles/2477977/3 "2025-04-27T13:43:53Z")

</div>

Thanks!

---

<div class="post-metadata">

**Author:** ![system](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/1/3/713c9d3f58553f0de89543d76a8a3a2779dc9fa4.png) [@system](https://forums.unrealengine.com/u/system)\
**Post date:** [May 27, 2025, 1:43pm UTC](https://forums.unrealengine.com/t/safety-of-using-throwaway-ftimerhandles/2477977/4 "2025-05-27T13:43:59Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
