Windows System Software -- Consulting, Training, Development -- Unique Expertise, Guaranteed Results

Home NTDEV

Before Posting...

Please check out the Community Guidelines in the Announcements and Administration Category.

More Info on Driver Writing and Debugging


The free OSR Learning Library has more than 50 articles on a wide variety of topics about writing and debugging device drivers and Minifilters. From introductory level to advanced. All the articles have been recently reviewed and updated, and are written using the clear and definitive style you've come to expect from OSR over the years.


Check out The OSR Learning Library at: https://www.osr.com/osr-learning-library/


re: [ntfsd] Exhausting NonPagedPool

OSR_Community_User-35OSR_Community_User-35 Member Posts: 154
Way back, last year, the following was posted. This may be
contributing to your observed leak.

-----Original Message-----
From: Eliyas Yakub [mailto:[email protected]]
Sent: Thursday, July 29, 1999 11:15 AM
To: 'Steve Hayward'
Cc: '[email protected]'
Subject: RE: [ntdev] IoCreateDevice/IoDeleteDevice memory leak


Yes it's a bug. It will be fixed in the post Win2K release. This memory leak
will happen only if you specify one of the following as your device type.

FILE_DEVICE_DISK
FILE_DEVICE_TAPE
FILE_DEVICE_CD_ROM
FILE_DEVICE_VIRTUAL_DISK

These values are specified only by storage devices, and at least on NT4.0,
once created these device objects are not deleted at all. Anyway thanks for
your feedback.

Eliyas

-----Original Message-----
From: Steve Hayward [mailto:[email protected]]
Sent: Thursday, July 29, 1999 2:51 AM
To: Eliyas Yakub
Subject: RE: [ntdev] IoCreateDevice/IoDeleteDevice memory leak


Eliyas

Thanks for your response I have found now the leak.
It seems that the IoDeleteDevice does not free the the VPB block. The
following code plugs the leak.

// extract the pointer to the Vpb
pVpb = pNewDeviceObject->Vpb;

// first free the VPB if it exits
if(pVpb != NULL)
{
// set value in the device object to NULL
pNewDeviceObject->Vpb = NULL;

// now free the buffer
ExFreePool(pVpb);
}

// now delete the device
IoDeleteDevice(pNewDeviceObject);

This is also backed up by the fact that creating devices as
FILE_DEVICE_UNKNOWN does not have the same leak problem.

Steve
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
[ To unsubscribe, send email to [email protected] with body
UNSUBSCRIBE (the subject is ignored). ]
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. Sign in or register to get started.

Upcoming OSR Seminars
OSR has suspended in-person seminars due to the Covid-19 outbreak. But, don't miss your training! Attend via the internet instead!
Kernel Debugging 13-17 May 2024 Live, Online
Developing Minifilters 1-5 Apr 2024 Live, Online
Internals & Software Drivers 11-15 Mar 2024 Live, Online
Writing WDF Drivers 20-24 May 2024 Live, Online