From: Eliyas Yakub [eliyasy@microsoft.com] Sent: Thursday, July 29, 1999 2:15 PM To: 'Steve Hayward' Cc: 'ntdev@atria.com' 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:shayward@avantis.co.uk] 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 ntdev-request@atria.com with body UNSUBSCRIBE (the subject is ignored). ]