Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: IOMalloc question




On May 11, 2007, at 3:14 AM, Tony Wong wrote:

Thanks for your help. I checked all the interface supported by IOMemoryDescriptor
but I cannot find one that can work for me. I think I need to give you more details.


I am writing a filter driver. In the read/write routines, I got a IOMemoryDescriptor
as input but I really need another buffer of the same size to do some processing.

You should not be allocating this buffer for each I/O, as I have already noted.


Instead, allocate a small pool of them by subclassing IOCommand and use an IOCommandPool to manage the free queue.

As Garth noted, you need to use an IOBufferMemoryDescriptor for the buffer, which you'd then attach to your IOCommand subclass.

I thought about reusing the memory buffer but I cannot assume that the sizes are all the same
and it will be hard to manage them this way. It is the kernel's job to manage memory.

It's your job to use it sensibly. You've been told how; now go for it. 8)


 = Mike

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-drivers mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/darwin-drivers/email@hidden

This email sent to email@hidden
References: 
 >Re: IOMalloc question (From: "Tony Wong" <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.