It does that b/c it is tracking each tag and it needs memory to store
the tag value on each reference. BUT, this only happens if you compile
your driver as chk . Also, if the allocation fails, the remlock acquire
still succeeds. On a fre build, the allocations/frees do not occur and
only the reference count is maintained (but tag verification is turned
off). If you look at the definition of IO_REMOVE_LOCK,
typedef struct _IO_REMOVE_LOCK {
IO_REMOVE_LOCK_COMMON_BLOCK Common;
#if DBG
IO_REMOVE_LOCK_DBG_BLOCK Dbg;
#endif
} IO_REMOVE_LOCK, *PIO_REMOVE_LOCK;
And then the routines
#define IoInitializeRemoveLock(Lock, Tag, Maxmin, HighWater) \
IoInitializeRemoveLockEx (Lock, Tag, Maxmin, HighWater, sizeof
(IO_REMOVE_LOCK))
#define IoAcquireRemoveLock(RemoveLock, Tag) \
IoAcquireRemoveLockEx(RemoveLock, Tag, FILE, LINE,
sizeof (IO_REMOVE_LOCK))
#define IoReleaseRemoveLock(RemoveLock, Tag) \
IoReleaseRemoveLockEx(RemoveLock, Tag, sizeof (IO_REMOVE_LOCK))
You see that the fre/chk nature of the remlock is a runtime check.
d
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Harish Arora
Sent: Friday, September 02, 2005 10:55 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] question about IO_REMOVE_LOCK
Hi,
I use remove lock to synchronize my dispatch routines with device
removal logic(IRP_MN_REMOVE_DEVICE)
I Initialized the remove lock with it’s own tag and then I monitored
that tag in PoolTag.exe. Looks like remove lock does some
allocation(NonPagedPool most probably) every time it is acquired and
then frees up the memory when it is released.
Why is that? As I understand, all it needs to do is simple refcnt logic.
I wanted to keep allocations|deallocations out of main IO path (as much
as possible) but this is making a big hole in that approach.
If art interprets our dreams, the computer executes them in the guise of
programs!
Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
You are currently subscribed to ntdev as: unknown lmsubst tag argument:
‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com