Mojo for Dark Age of Camelot (DAOC)
Home > Features > Delay SmartHeap memory crash
FEATURE

Delay the SmartHeap memory crash

One of the worst unfixed bugs in DAOC is a memory leak that causes the game to crash on some computers. This bug has been in the game for many years. The crash usually occurs after people have played in the frontier for several hours. The game displays a message like this one, then terminates:

Over the years this problem has been reported by hundreds of players on VN, PostCount, and other forums. It's unfortunate that Mythic has never fixed it.

Based on those reports the problem occurs mainly:

  1. With AMD video cards.

  2. After playing in New Frontiers for about two hours or longer.

How Mojo helps

Mojo can't fix this bug or prevent it completely, but it allows you to play for more hours before the bug makes the game crash.

To make this happen, check the box (red circle below) and launch a toon, team, or account with Mojo.

This option works only on 64-bit Windows.

This option increases DAOC's virtual address space from 2 GB to 4 GB so DAOC runs for a longer time before it runs out of memory.

Here's how this option works. If you turn it on, Mojo creates a copy of game.dll (the game's main executable file) and changes a single bit in that file from zero to one. That bit tells the operating system to increase DAOC's virtual address space. Then, when Mojo launches DAOC, it uses the copy instead of the original. Whenever game.dll gets patched, Mojo makes a new copy.

Please note that this option may make DAOC unstable in other ways. The SmartHeap bug will be postponed, but other problems may surface. Therefore this option could be a tradeoff. Most people think it makes things better but you may find in your case that it makes things worse.

A real fix

Only Mythic can really fix the problem. The bug has been in the game for years, so it doesn't look like that will happen. In the meantime you can probably avoid the issue by getting an Nvidia video card because the problem happens almost exclusively with AMD cards.

Or you can check the box circled in red in the picture above. As explained above, this won't fix the problem but will delay it. If it usually takes two hours for the crash to happen, with the box checked it might take five hours.

Another approach

One of the ways you can avoid the problem is by zoning out of New Frontiers or logging to desktop before the crash happens. This causes the DAOC client to release most of its memory.

In 2014 Mythic revamped New Frontiers in a such a way that each time you die, you zone out of NF. As I just explained, this will release memory. As a result, if you die often enough you'll no longer see the bug. As strange as it sounds, this means that the portal pad change in the 2014 revamp could be viewed as a workaround for the SmartHeap bug.

I'm not making this up. The DAOC development team suggested it in their patch notes on December 12, 2013:

When /releasing in the Frontiers now, players will zone back to the classic side of the Border Keeps as well. We realize zoning after each death can be an inconvenience but it should actually help increase performance over longer play sessions and on the game as a whole as zoning clears out a lot of the excess data on the game client and server."

They aren't talking only about the SmartHeap crash here, but about memory management problems in general on both the client and server.

Background

This bug is so common and so severe that I'm going to explain what it's all about.

First of all, what is SmartHeap? It's a commercial software library published by MicroQuill that gets built into applications like the DAOC client to manage memory.

If you've written a program in C++, you know you can create an object with the word "new". Normally that word invokes code supplied by the people who made the compiler. But if you pay a license fee to MicroQuill, you can replace that code with SmartHeap which is faster and more efficient. That's what Mythic did when they wrote DAOC.

It was perfectly reasonable for Mythic to use SmartHeap. Back when Mythic wrote DAOC, SmartHeap had an extremely good reputation and was widely used in commercial software. It still has a good reputation but it's probably less widely used today because compilers have become better.

What's happening here is that DAOC keeps creating objects. Each new object takes up a piece of memory. DAOC is supposed to destroy the objects when it's finished using them but under certain circumstances it forgets to do so. Eventually it runs out of one of the things which are required to make new objects, a thing called address space. (I'll explain address space in a moment.) When address space runs out, SmartHeap is no longer able to supply more memory for new objects. The next time DAOC tries to create an object, SmartHeap can't do it so it displays the error message. Then DAOC shuts down because it can't run without creating objects.

It's not RAM and it's not page file

This problem has nothing to do with physical memory (RAM) or page file.

If physical memory or page file were running out, every program on the computer would be affected. The whole machine would slow to a crawl. Windows would display anguished error messages every few seconds asking the user to close programs and free up memory.

The stuff that's running out is address space. Address space (in this case) is the numbers 0 through about two billion. That's right, DAOC is running out of numbers. More exactly, in this case, the numbers run from 1 through 2,147,483,647.

These numbers are used to identify pieces of memory. Without these numbers, DAOC would have no way to refer to one particular piece of memory instead of another. DAOC only has about two billion numbers to work with. When the numbers run out, DAOC can no longer refer to memory used for new objects, so it's forced to shut down.

Each process has its own address space. A process is a running instance of a program. If you have two copies of DAOC going at the same time, you’ve got two processes. When one process runs out of address space, others aren’t necessarily affected.

How does Mojo help with this? It increases the available numbers to about four billion so it takes longer for them to run out.

This page was created on January 19, 2014 and last revised on June 28, 2016.