- /* Out of memory. Write the active file to disk. */
- struct case_list *cur, *next;
-
- /* Notify the user. */
- if (!new_case)
- msg (MW, _("Virtual memory exhausted. Writing active file "
- "to disk."));
- else
- msg (MW, _("Workspace limit of %d KB (%d cases at %d bytes each) "
- "overflowed. Writing active file to disk."),
- set_max_workspace / 1024, info->max_cases,
- compaction_nval * sizeof (union value));
-
- free (new_case);
-
- /* Switch to a disk sink. */
- vfm_sink = create_case_sink (&disk_sink_class, NULL);
- vfm_sink->class->open (vfm_sink);
- workspace_overflow = 1;
-
- /* Write the cases to disk and destroy them. We can't call
- vfm->sink->write() because of compaction. */
- for (cur = info->head; cur; cur = next)
- {
- next = cur->next;
- if (fwrite (cur->c.data, sizeof (union value) * compaction_nval, 1,
- vfm_sink->aux) != 1)
- {
- msg (ME, _("An error occurred while attempting to "
- "write to a temporary file created as the "
- "active file: %s."),
- strerror (errno));
- err_failure ();
- }
- free (cur);
- }
-
- /* Write the current case to disk. */
- vfm_sink->class->write (vfm_sink, c);