If there is not enough memory available to keep the document with all its edits in memory and still perform manipulations such as sorting, dragging, scrolling, and so on quickly along with any other applications that are running, then Word moves part of its code that is not being used or part of the document that is not being edited from memory to disk. This movement to temporary files on disk frees more memory for text manipulation or storage of the parts of the document that are being actively edited.
Word uses temporary files as a "safety net" to protect against system errors in its file-saving scheme. By saving to a temporary file first and then renaming the file to the proper name, Word ensures the data integrity of your original file against problems such as a power failure or lost network connections that may occur while the file is being written.
The difference between this file and a traditional MS-DOS file is that multiple programs can read and write to these files without the original owner knowing about it. Additionally, document files have inherent properties that allow Word to create files and directories within files. You can determine that it is a document file because the initial size is 1, bytes. This temporary document file is used to store all OLE objects that belong to unnamed documents, Undo, the Clipboard, and documents whose native formats are not document format for example,.
Word can open document files using two different modes: transacted and direct. These modes are discussed later in this article. Transacted files allow Word to open a file, write to it, and have other programs--such as Microsoft Excel--write to it, but still retain the right to restore the file to the state it was in when Word first opened it.
Word opens all of the Word native files using transacted files, which create ghost images in the Temp directory. When you start Word, Normal. FastSave, for example, merges these two files when a save occurs. Word uses direct storage when opening the temporary document file and when performing either a Save As or a Full Save non-FastSave save.
This type of file is a low if any consumer of memory and does not create a ghost image when created or opened. The following tables list some of the specific temporary files that Word creates.
Word gains significant performance speed by placing the temporary file in the same directory as the saved file. The location where Word creates the temporary files is hardcoded information and cannot be edited. Therefore, it is important that NTFS permissions for the user are set accordingly. For more information, click the following article number to view the article in the Microsoft Knowledge Base:.
Many programs may also not use the operating systems temporary directory and instead store temporary files in a folder in the programs folder. Temporary files are meant to store information temporarily and don't rely on the information stored in the file. However, deleting a temporary file that is in use may cause errors with the program. To help prevent problems, many programs lock the file while in use to prevent it from being deleted.
When a program creates a temporary file, it's deleted after the document or program using that temporary file is closed. This scratch file holds information that is swapped out from the Word internal file cache, which is allocated from global system memory. The scratch file varies in size from 64 kilobytes KB to 3. Locked Files Temp Directory When you open a file that is locked, either because it is open in another window of Word or because another user on the network has it open, you can work with a copy of the file.
Word places this copy in the Windows Temp directory. Likewise, if a template attached to a document is locked, Word automatically makes a copy of the template in the Temp directory. Saved Files Same Directory as the Saved File When you click Save on the File menu, the following happens: Word builds a new temporary file using the edited version of the document.
After Word creates the temporary file, Word deletes the previous version of the document. Word renames the temporary file to the same name as the previous version of the document. When Word copies and pastes between documents, it may create a temporary file in the same directory as the source file.
This is especially true if the source file is saved or closed. The temporary file represents the information that was referenced by the Clipboard prior to saving the file.
Word creates this temporary file by renaming the old copy of the file to a temporary file name. Owner File Same Directory as Source File When a previously saved file is opened for editing, for printing, or for review, Word creates a temporary file that has a. This temporary file holds the logon name of person who opens the file. When you try to open a file that is available on a network and that is already opened by someone else, this file supplies the user name for the following error message: This file is already opened by user name.
Would you like to make a copy of this file for your use? Word may be unable to create an owner file. I made a plugin called "noswapsuck" that only enables the swapfile when the buffer contains unsaved changes. Once changes have been saved, the swapfile is cleared. Hence, swapfiles which contain the same content as the file on disk will be removed. Get it here: noswapsuck. It has been working well for me, but I have never publicised it before, so I would welcome feedback.
If the buffer has a swapfile, it will not be detected when the file is first opened. It will only be detected when swapfile is enabled, which is when you start to edit the buffer.
That is annoyingly late, and will interrupt you. Solved: We now check for a pre-existing swapfile when a buffer is opened, by temporarily turning the swapfile option on again. If you are working in an environment where you want to minimise disk-writes e. In such situations, you can do:.
By the way, I have another little plugin :DiffAgainstFileOnDisk which can be pretty useful after hitting r ecover , to check if the buffer you recovered is newer or older than the existing file, or identical to it. Stack Overflow for Teams — Collaborate and share knowledge with a private group.
Create a free Team What is Teams? Collectives on Stack Overflow. Learn more. How to prevent vim from creating and leaving temporary files? Ask Question. Asked 12 years, 9 months ago. Active 1 year, 8 months ago.
0コメント