Your ability to allocate pool is limited by more than the number of GB of RAM you have.
Kernel pool can become fragmented over time and this will limit the size of any particular allocation you can get. Also kernel pool has to share the kernel virtual address space with many, many other things and so its size is limited by that as well. Finally other kernel components allocate from the Pool so you won’t be able to get your “unlimited size” allocation with kernel pool.
Your best bet for a large buffer (IMO) is to use MmAllocatePagesForMdl() to allocate a large number of non-paged physical pages for your buffer. You can then use IoBuildPartialMdl() and MmGetSystemAddressSpecifyCache() to map reasonably sized windows of that buffer into the kernel virtual address space. You won’t have easy contiguous access to the entire buffer, but it should be much closer to “unlimited size” than you’re going to get from the system pool.
-p
-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@gmail.com
Sent: Monday, March 17, 2008 7:05 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] ExAllocatePoolWithTag won’t allocate more than 0x70ffff size of NonPagedPool of Data.
Hello there,
I am trying to allocate large data buffer using ExAllocatePoolWithTag on my kernel driver program and it did allocate until 0x70fffff on my machine. But the problem is beyond this size value, it won’t allocate anymore. Here’s what I did on my code:
PUCHAR DataBuf;
DataBuf = ExAllocatePoolWithTag(
NonPagedPool,
DataBufSize,
‘bBUF’);
if ( DataBuf == NULL )
{
return STATUS_INSUFFICIENT_RESOURCES;
}
DataBufSize can be set and when I try to set it more than 0x70fffff sizes, it will only return NULL on my DataBuf. My machine has a 1GB RAM and my OS is Windows XP SP2 freshly installed when no third party programs installed yet.
Any idea on how this code can allocate unlimited size based on my RAM resource available? I want my DataBuf to be allocated on a memory resident which should not be paged by the OS.
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