site_archiver@lists.apple.com Delivered-To: darwin-kernel@lists.apple.com On Aug 23, 2007, at 11:38 AM, JanakiRam wrote: There are serveral. = Mike _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-kernel mailing list (Darwin-kernel@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-kernel/site_archiver%40lists.a... I'm a newbie to the kernel programming. Can any one clarify my following querie(s). i) Is there any restriction imposed on the memory to be allocated inside a KEXT and its related functions . There are several restrictions. They are all pretty generous; if you hit any of them, you have a serious design problem. ii) If so , Whats the maximum limit ? - Kernel stacks are small. Do not allocate large auto variables. Ever. - Small allocations come from the zone allocator. The zone submap is constrained; the constraint may vary based on the amount of physical memory in the system. It is, fortunately, fairly fast. - Larger allocations come from the kernel map. You are constrained here by both the available kernel virtual space and the physical memory present in the system, since kernel memory is normally wired down. iii) Can i allocate 1MB ( i.e. char [1024][1024] ) memory in generic kext start function ? Yes, although you may want to do this with an IOBufferMemoryDescriptor so that you have the memory pre-wrapped for I/O purposes. As a general rule, however, if you are allocating large amounts of memory in a driver it's because you think that copying into/out of that memory is a good idea. Usually, you'll be wrong about that. You should, wherever possible, pursue designs that avoid copying, intermediate buffers, handoff between threads and other such obscenities. 8) This email sent to site_archiver@lists.apple.com