World of Warcraft

1 . 2
70
View All Posts by This User Toggle Ignore / Unignore This User
  • Stormrage
  • 1. Re: Memory, GC, World of Warcraft and You!   02/09/2007 06:36:52 AM PST
quote reply
I've seen lots of people who are seeing MORE freezes with 2.0.1
Unfortunately, this is a combination of a number of factors, but the resolution is already slated for 2.1.0! Let me first explain the components that are involved in causing this problem:

* Max AddOn Memory - This is the little box at the top right of your addons screen which tells the system how much memory you can use for all addons. This was originally put in to have a "cap" on the memory usage (which wasn't all that easy to monitor) and to prevent extremely large addons from using a huge amount of memory and causing problems. It was originally set to 32, but was increased to 48 at some point during the patch cycle. Most people have this value set to 48.

* Pause value - Remember before, when I talked about the "threshold" that started garbage collection in Lua 5.0? It waited until the system was at 1.5 times the last memory value before starting a garbage collection cycle, stopping the world. In Lua 5.1, the threshold value exists in the form of the "pause" attribute. This allows the system to run without ANY garbage collection for a period of time, only starting the incremental collector at a certain threshold. This is just in place to prevent the system from _always_ running, since while it’s awfully cheap due to the small steps it takes, it’s still not free.

In the default WoW installation, the max memory is set to 48, and the pause value is set to 200% (2 times) the last memory measurement. This means if a user logs into the system with 20 MiB of memory being used by addons, the garbage collector will start up at 40 MiB and then start taking its small steps to free memory. This is where the problem occurs.

If the user has more than 1/2 their max addon memory value (in our case, if they have 25 MiB initial memory) then garbage collection won't start until 50 MiB.. which we won't ever reach due to our max addon memory. When this happens, the system "panics" and runs a full garbage collection to see if it can free memory. This is a good thing, since otherwise your game would crash =). Unfortunately, when the system panics like this, no garbage has been freed (remember the collector hasn't been started yet) so it has QUITE a lot of memory to go through, and even more to free. This can cause a very significant pause of your game under certain circumstances.

Okay, so what's being done to fix it?
In the 2.1.0 patch, slouken has reworked a lot of the memory system to make it more efficient, and changed the way memory is being allocated in a way that will drop the amount of memory being used by the default UI, and possibly by addons as well. Here are the net changed to the memory system in 2.1.0:

* Script memory can now be tracked on a per-addon basics. You can call the UpdateAddOnMemoryUse() function to calculate the system memory, and then call GetAddOnMemoryUse(index or "name") to get the addon's memory in KiB.
* The memory system has been optimized and garbage collection has been tuned.
* There is no longer a "Max Addon Memory" setting available, it should no longer be needed.
* Players will be able to see the top three addons in memory usage, within the default UI. Custom addons will be able to display more detailed information about addon memory usage.

Display the information in an intelligent way.
Healing assignments
Decurse assignments

http://cladhaire.wowinterface.com
70
View All Posts by This User Toggle Ignore / Unignore This User
  • Stormrage
  • 2. Re: Memory, GC, World of Warcraft and You!   02/09/2007 06:37:56 AM PST
quote reply
What? What does that mean for me?
If you remember, the main problem we have with 2.1.0 is the system is waiting too long to start garbage collection (its a long process when done incrementally) and that can get us into trouble. The "pause" timer is being tuned to a more appropriate value which starts garbage collection early enough to keep the system memory in check, and smooth out the memory issues that some people have been seeing.

Its unclear what value this has been set to at the moment (I'd suspect somewhere around 115% or 120%), but lets assume its been set to 120%. This means the garbage collection system begin when the memory is at 120% of the last memory usage. If we load the game with 20 MiB of addons and UI, the garbage collection system will BEGIN at 24 MiB. The garbage collection system has a number of phases and steps to run through, so you won't see an immediate drop in memory usage when you hit the threshold, but overall you should see much tighter bounds on the system memory. A graph may help illustrate a bit better:

Memory usage under Lua 5.0 a (*) represents garbage collection

/| /| /|
/ | / | / |
/ | / | / |
/ | / | / |
/ |/ |/ |
------------------
* * *
Each garbage collection potentially caused a small pause in the game play while the garbage collector ran. Also note that under 5.1 with a bad max threshold value, you would see this same behavior.

Memory usage under Lua 5.1 would look similar, but with different behavior:

/\ /\ /\
/ \_/ \__/ \_
/
-----------------
* * *
This an extreme oversimplification, but it will help us illustrate the behavior. Garbage collection will begin at 1.2 times the minimum memory usage. The garbage collector will take a series of steps each time its called, looking at the memory to see what it can free. Once it has a full list of what is old, it will start releasing them bit by bit until the "old" list is empty. Then the garbage collector will set a new threshold, and wait until its time to start the process all over again. What you should see in this system is a smoother progression of memory usage.

You got a bit technical there, WHAT DOES THIS MEAN?
Under normal playing circumstances, as a result of 2.1.0 you should see overall lower memory usage due to the changed in allocation, and you should have a smoother game play experience without sudden pauses for garbage collection.

Do you promise?
That’s what the public test realms are for. Blizzard is no doubt working to tune the values and test their systems, but its all of our responsibility to hop on the 2.1.0 test realms when they come up to test out the new system and see how it works. While I've tested all of these observations on the current WoW client (which I've tuned to match the new threshold values) there could be other changes that come to pass.

Blizzard is clearly determined to help make our game play experience better by improving their internal systems when they affect performance. I'll continue to test and monitor the system to give any feedback possible.

What can I do as an addon developer?
Each addon developer has a commitment to ensuring they understand Lua best practices, and doing their best not to generate unnecessary garbage. My general rule is, if the action is somethign that the user initiates, and doesn't happen in combat (like opening a configuration window) you can afford to do more expensive things there, if necessary. The biggest sticking points for unnecessary garbage creation is often table creation in response to events, or OnUpdate. We have a great community, and if you as an addon author (or user) note a "problem" with your addon, feel free to ask the community to look over what you have and provide suggestions. Peer review works great in this sort of community!


Display the information in an intelligent way.
Healing assignments
Decurse assignments

http://cladhaire.wowinterface.com
70
View All Posts by This User Toggle Ignore / Unignore This User
  • Stormrage
  • 3. Re: Memory, GC, World of Warcraft and You!   02/09/2007 06:38:59 AM PST
quote reply
There's this bowl of soup...

Display the information in an intelligent way.
Healing assignments
Decurse assignments

http://cladhaire.wowinterface.com
70
View All Posts by This User Toggle Ignore / Unignore This User
  • Stormrage
  • 4. Re: Memory, GC, World of Warcraft and You!   02/09/2007 06:39:59 AM PST
quote reply
I happen to prefer oyster crackers, I have to say...

Display the information in an intelligent way.
Healing assignments
Decurse assignments

http://cladhaire.wowinterface.com
70
View All Posts by This User Toggle Ignore / Unignore This User
  • Stormrage
  • 5. Re: Memory, GC, World of Warcraft and You!   02/09/2007 06:41:07 AM PST
quote reply
But some days, saltines are the way to go..

Display the information in an intelligent way.
Healing assignments
Decurse assignments

Cladhaire (on his new Druid main)
70
View All Posts by This User Toggle Ignore / Unignore This User
  • 6. Re: Memory, GC, World of Warcraft and You!   02/09/2007 07:14:38 AM PST
quote reply
wow nice post! VERY informative...and not too technical at all :)




If you want this stickied, click the "biohazard" symbol next to quote. DO NOT say "needs a sticky!". Blizzard does not look at threads unless they are reported via the biohazard.

[ Post edited by Azmenen ]


a little something for your ear-hole



I can count all the way to shfifty-five faster than you can say shwooptie pooptie pants
80
View All Posts by This User Toggle Ignore / Unignore This User
  • Dunemaul
  • 7. Re: Memory, GC, World of Warcraft and You!   02/09/2007 07:44:11 AM PST
quote reply

Q u o t e:
I happen to prefer oyster crackers, I have to say...


I dunno why, but this reminded me of

"The time has come," the Walrus said,
"To talk of many things:
Of shoes--and ships--and sealing-wax--
Of cabbages--and kings--
And why the sea is boiling hot--
And whether pigs have wings."


Good post, very informative. Also, first page!

We love you Dr. Funkenstein,
Your funk is the best.
70
View All Posts by This User Toggle Ignore / Unignore This User
  • 8. Re: Memory, GC, World of Warcraft and You!   02/09/2007 08:25:42 AM PST
quote reply
Very informative!

[ Post edited by Sohjiro ]

60
View All Posts by This User Toggle Ignore / Unignore This User
  • 9. Re: Memory, GC, World of Warcraft and You!   02/09/2007 11:07:07 AM PST
quote reply

Q u o t e:
There's this bowl of soup...


Mmm, soup.

Nice post!

A hugely digested synopsis for developers is:

* Dont be afraid of reasonable levels of garbage, the system will stop penalizing you for it.
* Do be careful of excessive garbage, even the best incremental system still has to spend time to clean it up.

And for users:

* It's only getting better
* There will be one less setting to worry about
* You'll have more tools available to track down memory problems

UI and Macros Forum MVP - Understand GC!
70
View All Posts by This User Toggle Ignore / Unignore This User
  • 10. Re: Memory, GC, World of Warcraft and You!   02/09/2007 12:43:28 PM PST
quote reply

Q u o t e:

* Dont be afraid of reasonable levels of garbage, the system will stop penalizing you for it.
* Do be careful of excessive garbage, even the best incremental system still has to spend time to clean it up.


And that also means
* Don't be lazy and waste space. Even the best garbage collector can't do everything for you.

Word to the wise: The one thing I've always found with garbage collectors is that it makes programmers lazy. Please don't be that person.

Also very nice post :)

Shirik - Co-Author RDX.Cid
http://rdx.emoemu.com

Author, MuteButton 2.0
http://www-en.curse-gaming.com/files/details/6310/mutebutton-2-0/
Blizzard Entertainment
View All Posts by This User ignore-inactive
Slouken
Blizzard Poster
  • 11. Re: Memory, GC, World of Warcraft and You!   02/09/2007 01:29:45 PM PST
quote reply
If you want to get a sneak peek at the new settings in 2.1.0, you can do this:
/script collectgarbage("setpause", 110)

Enjoy!

Edit: Great post by the way! Thanks Cladhaire!

[ Post edited by Slouken ]

70
View All Posts by This User Toggle Ignore / Unignore This User
  • 12. Re: Memory, GC, World of Warcraft and You!   02/09/2007 01:32:19 PM PST
quote reply

Q u o t e:
If you want to get a sneak peek at the new settings in 2.1.0, you can do this:
/script collectgarbage("setpause", 110)

Enjoy!

Ah, thanks Slouken :)

Shirik - Co-Author RDX.Cid
http://rdx.emoemu.com

Author, MuteButton 2.0
http://www-en.curse-gaming.com/files/details/6310/mutebutton-2-0/
70
View All Posts by This User Toggle Ignore / Unignore This User
  • 13. Re: Memory, GC, World of Warcraft and You!   02/09/2007 02:34:32 PM PST
quote reply
Great info, thanks for laying it out like that :-D

Philemon, 70 Human Priest: http://ctprofiles.net/9179
71
View All Posts by This User Toggle Ignore / Unignore This User
  • 14. Re: Memory, GC, World of Warcraft and You!   02/09/2007 03:22:30 PM PST
quote reply
Very impressive... And informative... Thanks so much :)
70
View All Posts by This User Toggle Ignore / Unignore This User
  • Zangarmarsh
  • 15. Re: Memory, GC, World of Warcraft and You!   02/09/2007 04:03:25 PM PST
quote reply

Q u o t e:
If you want to get a sneak peek at the new settings in 2.1.0, you can do this:
/script collectgarbage("setpause", 110)


Possibly a silly question, but how does this command applied? Is it something you can enter once and have it apply for the entire computer's installation, something that you will have to run for each character/account, or a command that you'll need to run each gaming session?

When Forsaken reincarnate, the bad ones become Night Elves..
80
View All Posts by This User Toggle Ignore / Unignore This User
  • 16. Re: Memory, GC, World of Warcraft and You!   02/09/2007 04:19:42 PM PST
quote reply
great post! I really liked what you had to say about mem allocation but I'm still missing one piece of info...

what should I set my mem to?

I'm currently running the Photek6.5 comp and set it for 128. I have a gig of ram (soon to be 2 gigs) and I notice the occational lock up.

How can we tell what our 'optimal' settings for ram be? Is there a benchmark or a general rule of thumb?

Thanks!
60
View All Posts by This User Toggle Ignore / Unignore This User
  • 17. Re: Memory, GC, World of Warcraft and You!   02/09/2007 06:15:01 PM PST
quote reply

Q u o t e:
great post! I really liked what you had to say about mem allocation but I'm still missing one piece of info...

what should I set my mem to?

I'm currently running the Photek6.5 comp and set it for 128. I have a gig of ram (soon to be 2 gigs) and I notice the occational lock up.

How can we tell what our 'optimal' settings for ram be? Is there a benchmark or a general rule of thumb?

Thanks!


For the most part 'set it to 0 and dont worry about it' is a good benchmark these days. You're only at risk from an out of control AddOn using up all of your memory and forcing you to exit WoW, but it'll do that no matter WHAT you set your limit to (just sooner, if it's too low).

My feeling about the memory threshold is ithat it's currently of most use to developers, since it helps us spot silliness faster, but for users it's mostly a cause of annoyance than anything else -- Slouken's already announced ithe limit is going away in 2.1, so set it to 0 and get ahead of the crowd! (Use the /script line he included above as well to make your memory experience even smoother)

UI and Macros Forum MVP - Understand GC!
70
View All Posts by This User Toggle Ignore / Unignore This User
  • 18. Re: Memory, GC, World of Warcraft and You!   02/09/2007 07:21:01 PM PST
quote reply

Q u o t e:


(Use the /script line he included above as well to make your memory experience even smoother)



the 'how' of this was asked above... just once? every char etc?

need more rage...
http://ctprofiles.net/73182
a vid... http://tinyurl.com/kornd
warrior macros http://tinyurl.com/y34vxt
Blizzard Entertainment
View All Posts by This User ignore-inactive
Slouken
Blizzard Poster
  • 19. Re: Memory, GC, World of Warcraft and You!   02/09/2007 07:43:40 PM PST
quote reply
Just stick in a macro and run it every time you log in. Combining that with setting your memory limit to 0 is very close to what will be the default in 2.1.0.
1 . 2
Forum Nav : Jump To This Forum
Blizzard Entertainment