PRB: Available Memory Decreases When Print Job Terminated

ID Number: Q75430

3.00

WINDOWS

Summary:

SYMPTOMS

When a print job is terminated, the amount of available memory

reported in the Program Manager's About box declines. This

indicates that allocated memory objects remain on the global heap.

CAUSE

One possible cause is an application that calls the print job abort

procedure directly through its instance thunk. If, after this call,

the print job is aborted and the application exits its printing

loop without calling the ABORTDOC printer escape, the print job

will not be properly aborted and allocated memory will be left on

the heap.

RESOLUTION

The abort procedure returns FALSE if the print job has been

aborted. If the abort procedure returns FALSE, the application

should call the ABORTDOC printer escape. The following code

fragment demonstrates this procedure:

// Call the Abort procedure

if (!(*lpfnAbortProc)(hDC, 0))

Escape(hDC, ABORTDOC, NULL, NULL, NULL);

More Information:

An application registers its printing abort procedure with Windows by

calling the SETABORTPROC escape. Windows automatically calls the abort

procedure during the NEWFRAME or NEXTBAND escape. If the print job is

aborted during the NEWFRAME or NEXTBAND escape, Windows automatically

calls the ABORTDOC escape.

If the print job is aborted when the application has called the abort

procedure directly, the application must call the ABORTDOC escape.