| Previous | Next |
| ERROR_SIGNAL_REFUSED | ERROR_NOT_LOCKED |
ERROR_DISCARDED
What ERROR_DISCARDED means
ERROR_DISCARDED is Win32 system error code associated with the documented message: “The segment is already discarded and cannot be locked.” The significant condition is that a movable legacy memory segment has already been discarded, so a later lock request has no backing storage to pin.
The term “segment” here refers to movable memory used by historical Windows and OS/2-style programming models. In this case, this is not the same as a modern virtual-memory region reported by tools such as VirtualQuery.
Likely causes
- a 16-bit component retained a stale selector or segment handle after memory pressure
- cleanup discarded a movable segment while another path still expected to lock it
- an emulator or compatibility layer exposed lifecycle behavior that the old application did not anticipate
Troubleshooting steps
- Capture the segment handle at allocation, discard, and lock points
- Verify whether the failure occurs only after memory pressure or task switching
- Test the component in the intended compatibility subsystem and compare its segment-lifetime trace
Code-specific investigation notes
A discarded movable segment has lost its backing contents but may still be represented by a handle. Code that treats the handle alone as proof of valid storage can therefore fail later.
Look for memory-pressure callbacks and discardable-resource policies in addition to explicit discard calls. The segment may have been released by the compatibility memory manager.
A correct repair re-establishes the data or prevents premature discard; repeatedly locking the stale handle cannot reconstruct the segment contents.
Example
A compatibility component retains a stale segment lifecycle state across an error path. The next memory operation encounters that state and returns it.
Difference from related errors
ERROR_LOCKED says a segment is still locked and cannot be reallocated; it is the opposite lifecycle problem—the segment contents are already gone when code tries to lock them.
References
Looking for a different code? Search another status or error code.
