- Deallocating memory
- Posted by Kid of the neon on May 13th, 2008
I allocate memory by ExAllocatePoolWithTag in a driver for WinXP. When I try
to free memory with ExFreePoolWithTag, there appears BSOD. Crash dump
analysis shows that
Arg1: 00000012, caller is trying to free nonpaged pool at an IRQL above
DISPATCH_LEVEL
Arg2: 00000008, current IRQL
Then, how I should free allocated memory?
- Posted by Maxim S. Shatskih on May 13th, 2008
ExFreePool cannot be called from the ISR or KeSynchronizeExecution callback
or under interrupt spin lock.
--
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
maxim@storagecraft.com
http://www.storagecraft.com
"Kid of the neon" <Kid of the neon@discussions.microsoft.com> wrote in message
news:2F2E1562-C28F-42AD-A8A4-106188294F58@microsoft.com...
- Posted by Don Burn on May 13th, 2008
You cannot allocate or free memory at device IRPQ. You need to change your
logic to release the memory once the IRQL is down to DISPATCH_LEVEL or
lower.
While I do not know your code, the error below is typically caused by trying
to free the memory in the interrupt service routine once the transfer to the
device is complete. If so defer the freeing of the memory to the time you
complete the IRP in the DPC routine.
--
Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting
Website: http://www.windrvr.com
Blog: http://msmvps.com/blogs/WinDrvr
Remove StopSpam to reply
"Kid of the neon" <Kid of the neon@discussions.microsoft.com> wrote in
message news:2F2E1562-C28F-42AD-A8A4-106188294F58@microsoft.com...
- Posted by GNR on May 14th, 2008
I hope you do have a DPC scheduled out of the ISR.
Is the free call made in the ISR? Or in a routine at high IRQL?
--
--GNR
"Don Burn" wrote: