IT Times LogoIT 
   Times Logo
IT Times Logo

in this issue...
Web Site Highlights Campuswide Role

Faster Connectivity At Home? Could Be

LEAD Report Released

Linux: A Realistic Alternative to Windows?

Virtual History: Web Site for Teachers

New Open-Access Lab in Surge IV

Do I Really Need This?

Move Over Godzilla: Mothra Web Site Revamp

Results of Windows 2000 Professional Tests

When 348 Open Files Are Not Enough

Biting the Bullet on the World Wide Web

TAPS Goes Online

IT Staff in the News

Letters to the Editor

Volume 8, Number 6
feedback archives search the IT Times IT Times home

 

When 348 Open Files Are Not Enough
A Technical Note

By Paul Waterstraat, Geology Department

 
For more details and practical advice, please see our sidebar on Open File Resources.

You've been typing for hours, and now it is time to save that masterpiece. But before you can call it a day, your computer serves up some bad news: "Word cannot save your document because of an error. Either the disk is full or you're out of memory. You should try closing some windows or quitting some applications and try again." But you can't! You know you've got plenty of empty disk space and loads of free RAM. What could be wrong?

Lots of Open Files
Your operating system and applications have a lot more files open than you might think. For instance, the Macintosh operating system (OS), like any other operating system, has a limit on the number of files that can be open at the same time. For Mac OS 7 and 8, this limit is 348 simultaneously open files (348, woo-hoo!). Sounds like a lot, doesn't it? Wrong!

Each active font in your system requires a file slot (up to 128 for fonts). So do many system extensions. For example, right now, on my desktop Macintosh 8100, running Mac OS 8.6, with only Finder, Meeting Maker, and Microsoft Word 98 running, my system has 213 open files. When I launch Adobe Acrobat, it opens a lots of plug-ins and fonts of its own, and the number of open files jumps to 269. Opening Canvas 6 can chew up another 96 open file slots.

Once you're out of open file slots, you may not be able to save your work (unless you close some of those open files). The application knows it tried to save a copy of your document to disk but couldn't. The message you get when you try to save your work at this point may be misleading. The application may claim that you are out of memory or that the disk is full. If you know you've got lots of RAM free and you still have 2.7 gigabytes of disk space free, you may become perplexed.

File Number 349 illustration

But I only work in one application at a time -- This can't happen to me!
Famous last words. Here's an example:

Suppose you're working in Microsoft Word 98. Suppose you have "Save AutoRecovery info every: 5 minutes" enabled in the Save preferences (typically a good thing). Suppose you're on a tight deadline; you're working furiously and without interruption -- you're on a roll! Now, suppose you began working on your masterpiece at 8:00 a.m., and it's now 7:17 p.m. You know you're backed up because Word has been dutifully saving your work every five minutes since you started.

But suddenly you get a dialog box telling you that "Word cannot save your document because of an error, either the disk is full or you're out of memory, you should try quitting some applications and try again." You notice that the name of your document in the title bar at the top of the window has changed from "Big Grant Proposal" to "Word Work File 23415".

You check, but you have no other applications running that you can quit. You check your disk and find you still have 2.7 GB of free disk space. You try doing another Save, but only get the same result. You look in the folder that contains your original document and notice 135 files named variations of "Word Work File" with creation times that are all about five minutes apart. It's late. You're tired and hungry. You don't need this. You get that sinking feeling in the pit of your stomach.

In desperation you try to open the Control Panels to shut some other thing down, but you get a dialog box informing you that you can't open the Control Panels because there are no open files left. You try to open the Chooser so you can save your document to the shared network volume, but you get a dialog box informing you that you can't open the Chooser because there are no open files left. In desperation you think, "OK, I'll print a copy of the document and then just type it all in again tomorrow!" You select Print, but get a dialog box informing you that you don't have a printer selected and you need to go to the Chooser to select a printer. You try to open the Chooser, but you get a dialog box informing you that you can't open the Chooser because there are no open files left.

Now you may be feeling downright sick. . . .

What Happened?
Microsoft Word has an "issue" (some people might say "bug") which causes it not to close its temporary save files until you close the main document. (And even then, Word may not close all its work files until you quit the application.) Let's say you began with 213 open files when you started working on your document. Word has been creating and opening new temporary files every five minutes for the last 11 hours and 17 minutes, 135 files in all. 213 + 135 = 348. You've reached the maximum number of open files the system can manage. You're stuck! Or are you?

What can I do?
Sometimes Word leaves some of those temporary work files around when you quit. You could try quitting Word, hoping that it will leave the last work file around. If so, you could recover up to the last five minutes of work. Murphy's Law tells you this won't happen.

Some have suggested that you duplicate the most recent work file and copy it to another folder so Word won't delete it. Unfortunately, the copy of the file will contain zero bytes because the operating system can't open the file in order to copy the contents to the new file.

What you can do is select everything in your document, copy it to the clipboard, select New from the File menu to create a new blank document window, and then paste your text into the new document window. Next, close the original document (you might want to hold your breath while you do this). You won't be able to save changes, but closing the original document should, in turn, close many of the temporary files. Now you should be able to save the new document. (After your document is saved you can breathe again -- then make a backup of the new document.)

How can I avoid this problem?
The first thing I'd recommend is not working in any application continuously for many, many hours. Take a break, quit the application, and walk around for a bit, maybe even re-boot. Even if your application doesn't have an open files issue, it may have other bugs, such as memory leaks, that eventually will bite you. (By the way, in Macintosh OS 9, Apple boosted the number of simultaneously open files to 8,169.)

This note draws upon information posted to MacInTouch and MacFixIt during the last year and also several articles in the Macintosh Weekly Journal. Mark Siegenfeld of the CAIT assisted me in understanding some details about Windows.