a DMA issue

I want to free a DMA common buffer, which is allocated by “WdfCommonBufferCreate” function.
How can I?

thanks a lot!

When you delete the WDFDMAENABLER object, the WDFCOMMONBUFFER will also be
deleted, as it’s automatically the parent (and can’t be changed). Common
buffers usually are long lived. If you just use a common buffer for a
transaction, you might create a pool of them (like stored in a
WDFCOLLECTION) and when you need one you pluck it from the pool and when
you’re done with it you put it back in the pool. When the driver shuts down,
you free the DMA enabler and the common buffers all go away. As common
buffers are physically contiguous memory, you should not really be
allocating and freeing them on a regular basis, as you may find allocation
failures happen. I just did a driver two months ago that used a small pool
of common memory allocations, which were used to hold an array of DMA
transaction fragment entries for the hardware to walk though.

Jan

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:bounce-405461-
xxxxx@lists.osr.com] On Behalf Of xxxxx@hotmail.com
Sent: Friday, March 19, 2010 12:46 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] a DMA issue

I want to free a DMA common buffer, which is allocated by
“WdfCommonBufferCreate” function.
How can I?

thanks a lot!


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

>When you delete the WDFDMAENABLER object, the WDFCOMMONBUFFER will also be

deleted, as it’s automatically the parent (and can’t be changed). Common
buffers usually are long lived. If you just use a common buffer for a
transaction, you might create a pool of them (like stored in a
WDFCOLLECTION) and when you need one you pluck it from the pool and when
you’re done with it you put it back in the pool. When the driver shuts down,
you free the DMA enabler and the common buffers all go away. As common
buffers are physically contiguous memory, you should not really be
allocating and freeing them on a regular basis, as you may find allocation
failures happen. I just did a driver two months ago that used a small pool
of common memory allocations, which were used to hold an array of DMA
transaction fragment entries for the hardware to walk though.

It seems that I should create a memory pool.
It is a good idea.

thanks!!