Quantcast WoWInterface - View Single Post - Calling SetText on a FontString inside OnUpdate
View Single Post
02-07-19, 05:18 AM   #1
Mayron
A Frostmaul Preserver
 
Mayron's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2010
Posts: 260
Calling SetText on a FontString inside OnUpdate

I am calling a function every 0.05 seconds in an OnUpdate script and it has this line in it:

Lua Code:
  1. timeRemaining:SetText(math.random());

This causes a memory leak issue where my AddOn's memory will keep on increasing persistently (not a lot but it builds up and up forever...).

If SetText is always a newly created string but the value is the same then this problem does not occur. Also, I can create many new strings in the OnUpdate function but that does not seem to be a problem. It only occurs when used with a widget to update the UI.

Is there a better memory optimized way of handling this?
  Reply With Quote