RE: [NTDev] Proper order of tearing down an MDL ...

>

> Hmmm, since it’s IoAllocateMdl links it to
> IRP->MdlAddress->Next, do I need
> to call IoFreeMdl, or will that happen when IoCompleteRequest
> tears down the
>
> IRP?

I’ve never paid much attention to chaining MDLs with the Next ptr, but
it sounds like the system is cleaning up the portion you append; this
is how it is able to unmap your data buffers from system space currently.
If it did not, a few large I/Os would exhaust your PTEs immediately,
overlapped or not.

It’s true that the Io completion routines will go through the list of MDLs
and free them, however, it won’t unlock and unmap them.
From my NT4 experience, the unlock and unmap was issued only if MdlFlags was
MDL_PARTIAL (which happens if the MDL is allocated with IoBuildPartialMdl).
Are you running a free build ? If this is your problem and you’ll run a
check build, you should hit an ASSERT when trying to free a mapped MDL.

Sara


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com