Friday, October 12 2012

“Out of memory” as a generic error

After the most recent patch, Torchlight 2 refused to launch due to “out of memory” errors. It seemed related to having mods installed, since it was still playable without them. The only mod I had installed was one I created as a test (a one-liner that slightly increased magic-item drop rate in random Mapworks maps), so this didn’t affect my gameplay at all, but I was curious enough to try to debug it.

Was it a change in how it handles mods? Had they added bounds-checking to keep people from doing things like increasing the drop rate? Had they introduced a regression in their archive-file-loader, or maybe fixed an old error that third-party archivers tripped? Etc, etc, etc.

In the end, the problem was simple, yet completely unrelated to memory: I had shared the data directory, mounted it from my Mac, and copied the archive files over, convincing Windows that I had a file open. I had made my mod on the Mac, since all the current tools are Python-based, and I saw no point in either setting up a Windows Python environment or using py2exe binaries downloaded from random web forums.

The error-handler in their startup code just assumes it ran out of memory when anything goes wrong. Hopefully their debug builds are a bit more precise.