| Previous | Next |
| ERROR_SERVICE_NOTIFICATION | ERROR_LOG_HARD_ERROR |
ERROR_WAS_LOCKED
A requested memory lock encountered a page that was already locked
ERROR_WAS_LOCKED corresponds to Win32 error value documented as: {Page Locked} One of the pages to lock was already locked. Windows completed or evaluated a locking operation and found that at least one page already had the locked state. This can expose overlapping lock ranges or duplicated ownership assumptions.
Where the result appears in real systems
- Native caches pinning working-set pages.
- Multimedia or real-time components using VirtualLock.
- Two subsystems independently managing the same shared buffer.
What to collect before making changes
Record address and byte count for every lock request; normalize ranges to page boundaries; compare overlapping owners; query the region protection and committed state before changing cleanup logic.
Handling and recovery
Make lock ownership reference-counted at the application level when ranges can overlap. Unlock only when the final owner releases the page, and tolerate an already-locked condition when it is semantically harmless.
What not to infer from this code
This result reports prior state, whereas ERROR_WORKING_SET_QUOTA or ERROR_NOT_ENOUGH_MEMORY indicates that Windows could not satisfy a new lock because of resource limits.
References
Looking for a different code? Search another status or error code.