by modernist » Sun Jan 03, 2016 12:21 pm
well it depends how often you cycle the creation of frames within a function, a good rule is to only create your frames outside so they will only ever be run once on login — or yeah, carefully recycle 'em.
for example, CustomNameplates is a really good example of a major addon NOT doing this and the reason i would not recommend it to people based on the code i've looked through — if i remember correctly it creates a set of 8 new "buff" frames on every tick of its OnUpdate. assuming that you're running at a consistent 60fps, thats 28800 frames being created and stacked on top of one another inside of a minute.
but in that case you couldn't use XML either, since the frames are parented to a scaling number of (dynamically created) nameplate frames.
the "keep it neat" thing makes sense, and i've sometimes used global vars so that i can keep frame creation in a 2nd, separate lua file. I wish there was the option to use namespaces as available in retail wow.