Is it possible to run out of memory?

Is it possible to run out of memory? The reason I ask is that I get the below error message and to my knowledge none of the conditions listed are valid. I’m about 85% done with my story but still have the final meta-puzzle to code and a few other things. I’m also in alpha now so there are likely to be more changes that may take more memory…

Translating the Source - Failed
The application ran your source text through the Inform 7 compiler, as usual, but the compiler unexpectedly failed. This should not happen even if your source text is gibberish, so you may have uncovered a bug in the program.

When a program like the I7 compiler fails, it typically returns an error number: this time, the number was 2, so I7 probably stopped because of a fatal file-system error.

It is very unlikely that your computer is at fault. More likely causes are:

disc space running out on the volume holding the project;
trying to run a project from a read-only volume, such as a burned CD or DVD;
trying to run a project which belongs to another user, whose files you have no permission to alter.
However, if you think it more likely that the Inform 7 compiler is at fault, please check that you have the currently distributed build of the system: if you have, please consider taking the time to fill out a bug report at the Inform bug tracker (www.inform7.com/bugs).

Sorry for the inconvenience.
2 Likes

Are you compiling to Glulux? That has an almost unlimited capacity as compared to Z-code. (Check in Inform 7 settings.)

3 Likes

Yes, I am compiling to Glulux but thank you for suggesting that, I hadn’t thought of it.

2 Likes

While I’m sure there are other reasons, when I’ve gotten that error for more than one compile attempt, I’ve needed to walk through recent changes in code. Perhaps my code misused memory, but my system itself didn’t have disk/memory problems.

I seem to recall it being due to seemingly innocuous issues like punctuation, but there may be other causes.

4 Likes

Wiser heads than mine will probably weigh in soon, but this looks to me like an error writing the compiler file to disk, so I wonder whether an overzealous antivirus program is a potential culprit? The IDE does sometimes run into trouble with them, unfortunately - might be worth temporarily deactivating any you have running and seeing if that fixes thins. If not, well, see first part of this post :slight_smile:

5 Likes

It’s possible to run out of memory on the virtual machine that will be interpreting your game file. But that’s not what’s happening here. Instead, Inform is having trouble reading or writing files on your disk during the compilation process.

My first guess is also an overzealous antivirus. Alternately, make sure Inform has permission to write to the folders where the compilation is happening.

6 Likes

This is just the generic message that appears when the Inform 7 compiler fails with error code 2. To see in depth what actually happened, you need to click on the “Console” page of the “Results” tab (top-left corner of the tab, where it says “Report” and “Console”), which will show the actual output of the compiler.

It would also be useful to know if you’re on Windows, MacOS or Linux. If on Windows, it would also help to know what anti-virus software you’ve got: as Daniel says, an over-zealous anti-virus program is the most likely culprit on Windows.

5 Likes

Thank you for the tip about the report console, I had never looked at this tab before. How can I use it to tell how much memory I have left to use?

Here’s what the tab looks like in the Windows IDE:

The toggle to access it is in the upper-right (“report” is the default so that’s probably why you haven’t seen it), and you can see the various pieces of information on memory scattered throughout – though again, you might not be getting accurate information here if an antivirus program is messing with things.

2 Likes

Odds are good how much memory you have left doesn’t have anything to do with your problem. Could you confirm you’re on Windows? If so, it looks like exit code 2 means “file not found”, which I’m guessing is the result of a permission problem. As to why that would suddenly crop up now when things had been working… did you upgrade the OS and/or any malware-protection software between the last time it worked and now? (I’m out of my depth with Windows issues; I’ve just seen that come up a lot in threads here.)

3 Likes

As Zed says, this is very unlikely to be about memory. What it perhaps will provide is more information on why the compiler exited with code 2, but you’ll have to report what it says …

3 Likes

It can’t hurt to look at the Console tab, but I suspect it will say “Compilation failed with error code 2” and no more information than that.

One thing to try: create a fresh Inform project with the same settings and paste the same source code in. If that compiles, then it’s a permissions (or antivirus) problem with the original project file. If it fails with the same error, then it’s something about the source code.

2 Likes

From personal experience, I’ve gotten the “out of memory” errors when I clearly wasn’t out of memory but just making an infinitely recursive call. The examples below are probably not what you’re seeing, but I want to write them for future reference, because someone else will make the mistakes I do.

The trivial example of this is from recursive function calls, such as

instead of jumping: try jumping instead;

or …

instead of waking up: try sleeping instead;

(The bugs we make are usually more complicated, but I wanted to isolate the problem.)

Another time I got an out of memory error was when I was creating a game map.

index map with room1 mapped west of room2.
index map with room1 mapped north of room2.

Again, the bug is probably not going to be this glaringly obvious. But I think what Inform is doing is that it keeps trying to increase the size of the internal stack or game map to accomodate where room 1 and room 2 might be, but there’s no way to. And the bigger the map is, and the more you try to fit rooms in like a jigsaw, the worse things might be.

2 Likes

That’s going to be a runtime memory error, which is not what this thread is about.

I would also like to remind the jury that nothing in the reported error messages indicates that anything is running out of memory. That was just a guess by the original poster, and it hasn’t been confirmed.

2 Likes

Yes, this was just my original guess because the game is getting big. But I was able to go back, based on the feedback from this post, and find the error.

Thank you, all, for your help!

2 Likes

So what was it?

3 Likes

I went back to the code I had just added before the error. I took it out, re-saved it, and then re-typed it and it was fine.

Just a wild stab in the dark — did you originally paste the code into your file?

I may have, it is similar code to what I used elsewhere.

The reason I mention it is because sometimes copy/pasting text into Inform from other apps (like web pages) will bring along non-printable characters (like non-breaking spaces) that Inform doesn’t like, but the text will look correct to you.

2 Likes