How to allocated more memory ?

Hi Group,

My system has 1 GB of memory. I am trying to allocate 127 MB memory in
my driver as follows

pMem = ExAllocatePoolWithTag( NonPagedPool, nSize, MYTAG );

However ExAllocatePoolWithTag() fails for any value greater than 110MB.

Can someone tell me how I should allocate more than 110MB memory?

Thanks
Check Abdoul

The DDK documentation says the following about the NonPagedPool: “Nonpaged
pool can be accessed from any IRQL, but it is a scarce resource and drivers
should allocate it only when necessary.”
Maybe the limit for this type of memory is about 110MB, so you are not able
to allocate more.

“CheckAbdoul” schrieb im Newsbeitrag
news:xxxxx@ntdev…
> Hi Group,
>
> My system has 1 GB of memory. I am trying to allocate 127 MB memory in
> my driver as follows
>
> pMem = ExAllocatePoolWithTag( NonPagedPool, nSize, MYTAG );
>
> However ExAllocatePoolWithTag() fails for any value greater than
110MB.
>
> Can someone tell me how I should allocate more than 110MB memory?
>
> Thanks
> Check Abdoul
> ------------------
>
>
>

Hi Markus,

Thanks for the reply. I understand that the NonPagedPool is a scarce
resource. However it is not like I have just 256MB of memory and trying to
allocate everything for my driver. If ExAllocatePoolWithTag(…) returns NULL
while there is not enough memory, that is understandable. However I have lot
of physical memory ( 1GB to 4GB ) in the system, and I do not understand why
I am not able to allocated more than the 110 MB value. Any clues ??


Cheers
Check Abdoul

“Markus” wrote in message news:xxxxx@ntdev…
> The DDK documentation says the following about the NonPagedPool: “Nonpaged
> pool can be accessed from any IRQL, but it is a scarce resource and
> drivers
> should allocate it only when necessary.”
> Maybe the limit for this type of memory is about 110MB, so you are not
> able
> to allocate more.
>
> “CheckAbdoul” schrieb im Newsbeitrag
> news:xxxxx@ntdev…
>> Hi Group,
>>
>> My system has 1 GB of memory. I am trying to allocate 127 MB memory
>> in
>> my driver as follows
>>
>> pMem = ExAllocatePoolWithTag( NonPagedPool, nSize, MYTAG );
>>
>> However ExAllocatePoolWithTag() fails for any value greater than
> 110MB.
>>
>> Can someone tell me how I should allocate more than 110MB memory?
>>
>> Thanks
>> Check Abdoul
>> ------------------
>>
>>
>>
>
>
>

Not really, but maybe this helps:

http://www.winguides.com/registry/display.php/1015/

It might be a bit risky to change the size of the NonPagedPool, but maybe
the calculation of Windows is the problem.

“CheckAbdoul” schrieb im Newsbeitrag
news:xxxxx@ntdev…
> Hi Markus,
>
> Thanks for the reply. I understand that the NonPagedPool is a
scarce
> resource. However it is not like I have just 256MB of memory and trying to
> allocate everything for my driver. If ExAllocatePoolWithTag(…) returns
NULL
> while there is not enough memory, that is understandable. However I have
lot
> of physical memory ( 1GB to 4GB ) in the system, and I do not understand
why
> I am not able to allocated more than the 110 MB value. Any clues ??
>
> –
> Cheers
> Check Abdoul
> ------------------
>
>
> “Markus” wrote in message news:xxxxx@ntdev…
> > The DDK documentation says the following about the NonPagedPool:
“Nonpaged
> > pool can be accessed from any IRQL, but it is a scarce resource and
> > drivers
> > should allocate it only when necessary.”
> > Maybe the limit for this type of memory is about 110MB, so you are not
> > able
> > to allocate more.
> >
> > “CheckAbdoul” schrieb im Newsbeitrag
> > news:xxxxx@ntdev…
> >> Hi Group,
> >>
> >> My system has 1 GB of memory. I am trying to allocate 127 MB memory
> >> in
> >> my driver as follows
> >>
> >> pMem = ExAllocatePoolWithTag( NonPagedPool, nSize, MYTAG );
> >>
> >> However ExAllocatePoolWithTag() fails for any value greater than
> > 110MB.
> >>
> >> Can someone tell me how I should allocate more than 110MB memory?
> >>
> >> Thanks
> >> Check Abdoul
> >> ------------------
> >>
> >>
> >>
> >
> >
> >
>
>
>

Because the system sets a maximum nonpaged pool, typically 128MB or 256MB
depending on the system and boot switches such as /3GB which forces 128MB.
There are games one can play, to get around this, and it is supposed to be
fixed in Vista.


Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting
Remove StopSpam from the email to reply

“CheckAbdoul” wrote in message news:xxxxx@ntdev…
> Hi Markus,
>
> Thanks for the reply. I understand that the NonPagedPool is a scarce
> resource. However it is not like I have just 256MB of memory and trying to
> allocate everything for my driver. If ExAllocatePoolWithTag(…) returns
> NULL while there is not enough memory, that is understandable. However I
> have lot of physical memory ( 1GB to 4GB ) in the system, and I do not
> understand why I am not able to allocated more than the 110 MB value. Any
> clues ??
>
> –
> Cheers
> Check Abdoul
> ------------------

CheckAbdoul wrote:

Hi Markus,

Thanks for the reply. I understand that the NonPagedPool is a scarce
resource. However it is not like I have just 256MB of memory and trying to
allocate everything for my driver. If ExAllocatePoolWithTag(…) returns NULL
while there is not enough memory, that is understandable. However I have lot
of physical memory ( 1GB to 4GB ) in the system, and I do not understand why
I am not able to allocated more than the 110 MB value. Any clues ??

Markus GAVE you the clues. The operating system limits the amount of
non-paged pool to a relatively small amount. Non-paged pool takes
memory away from EVERY process. Remember that, as important as kernel
drivers are, they are not the reason people buy computers. They buy
them to run user-mode applications.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

CheckAbdoul wrote:

Hi Group,

My system has 1 GB of memory. I am trying to allocate 127 MB memory in
my driver as follows

pMem = ExAllocatePoolWithTag( NonPagedPool, nSize, MYTAG );

However ExAllocatePoolWithTag() fails for any value greater than 110MB.

Can someone tell me how I should allocate more than 110MB memory?

Thanks
Check Abdoul

I don’t see a problem with how Windows is calculating this. Non-paged
pool is extremly scarce, and I’m even surprised Windows is letting him
allocate 10% of physical memory to it. Remember that your memory not
only has to be shared between programs and the kernel, but between every
other driver too. A fully-featured XP install with multiple application
drivers, harwdware drivers, etc, can have upwards of 50 loaded drivers.
If each one of those had the need for 100MB of non paged pool, we would
all be running on 64-bit 16GB systems. Even if Windows would somehow let
you allocate that much NP memory, what about users running on /3G or
with less memory? Your driver would likely crash the system.

Best regards,
Alex Ionescu

I don’t know why you are hitting a limit of 110 MB in particular.
Perhaps it is heap fragmentation or other kernel components using the
heap. What you might find interesting and surprising though is that
NonPagedPool is limited to approximately 256MB. It varies from version
to version of the OS. You can fiddle with the registry settings all you
want. Windows will not set aside more than about 256MB for NonPagedPool.

If you need a lot of non-paged memory you might need to look somewhere
else besides NonPagedPool.

Aaron Stavens
NetMotion Wireless, Inc.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Markus
Sent: Thursday, April 27, 2006 10:17 AM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] How to allocated more memory ?

Not really, but maybe this helps:

http://www.winguides.com/registry/display.php/1015/

It might be a bit risky to change the size of the NonPagedPool, but
maybe
the calculation of Windows is the problem.

“CheckAbdoul” schrieb im Newsbeitrag
news:xxxxx@ntdev…
> Hi Markus,
>
> Thanks for the reply. I understand that the NonPagedPool is a
scarce
> resource. However it is not like I have just 256MB of memory and
trying to
> allocate everything for my driver. If ExAllocatePoolWithTag(…)
returns
NULL
> while there is not enough memory, that is understandable. However I
have
lot
> of physical memory ( 1GB to 4GB ) in the system, and I do not
understand
why
> I am not able to allocated more than the 110 MB value. Any clues ??
>
> –
> Cheers
> Check Abdoul
> ------------------
>
>
> “Markus” wrote in message news:xxxxx@ntdev…
> > The DDK documentation says the following about the NonPagedPool:
“Nonpaged
> > pool can be accessed from any IRQL, but it is a scarce resource and
> > drivers
> > should allocate it only when necessary.”
> > Maybe the limit for this type of memory is about 110MB, so you are
not
> > able
> > to allocate more.
> >
> > “CheckAbdoul” schrieb im Newsbeitrag
> > news:xxxxx@ntdev…
> >> Hi Group,
> >>
> >> My system has 1 GB of memory. I am trying to allocate 127 MB
memory
> >> in
> >> my driver as follows
> >>
> >> pMem = ExAllocatePoolWithTag( NonPagedPool, nSize, MYTAG
);
> >>
> >> However ExAllocatePoolWithTag() fails for any value greater
than
> > 110MB.
> >>
> >> Can someone tell me how I should allocate more than 110MB
memory?
> >>
> >> Thanks
> >> Check Abdoul
> >> ------------------
> >>
> >>
> >>
> >
> >
> >
>
>
>


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

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

Thanks to everybody for the replies and the concerns.

Cheers
Check Abdoul

“Aaron Stavens” wrote in message
news:xxxxx@ntdev…
I don’t know why you are hitting a limit of 110 MB in particular.
Perhaps it is heap fragmentation or other kernel components using the
heap. What you might find interesting and surprising though is that
NonPagedPool is limited to approximately 256MB. It varies from version
to version of the OS. You can fiddle with the registry settings all you
want. Windows will not set aside more than about 256MB for NonPagedPool.

If you need a lot of non-paged memory you might need to look somewhere
else besides NonPagedPool.

Aaron Stavens
NetMotion Wireless, Inc.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Markus
Sent: Thursday, April 27, 2006 10:17 AM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] How to allocated more memory ?

Not really, but maybe this helps:

http://www.winguides.com/registry/display.php/1015/

It might be a bit risky to change the size of the NonPagedPool, but
maybe
the calculation of Windows is the problem.

“CheckAbdoul” schrieb im Newsbeitrag
news:xxxxx@ntdev…
> Hi Markus,
>
> Thanks for the reply. I understand that the NonPagedPool is a
scarce
> resource. However it is not like I have just 256MB of memory and
trying to
> allocate everything for my driver. If ExAllocatePoolWithTag(…)
returns
NULL
> while there is not enough memory, that is understandable. However I
have
lot
> of physical memory ( 1GB to 4GB ) in the system, and I do not
understand
why
> I am not able to allocated more than the 110 MB value. Any clues ??
>
> –
> Cheers
> Check Abdoul
> ------------------
>
>
> “Markus” wrote in message news:xxxxx@ntdev…
> > The DDK documentation says the following about the NonPagedPool:
“Nonpaged
> > pool can be accessed from any IRQL, but it is a scarce resource and
> > drivers
> > should allocate it only when necessary.”
> > Maybe the limit for this type of memory is about 110MB, so you are
not
> > able
> > to allocate more.
> >
> > “CheckAbdoul” schrieb im Newsbeitrag
> > news:xxxxx@ntdev…
> >> Hi Group,
> >>
> >> My system has 1 GB of memory. I am trying to allocate 127 MB
memory
> >> in
> >> my driver as follows
> >>
> >> pMem = ExAllocatePoolWithTag( NonPagedPool, nSize, MYTAG
);
> >>
> >> However ExAllocatePoolWithTag() fails for any value greater
than
> > 110MB.
> >>
> >> Can someone tell me how I should allocate more than 110MB
memory?
> >>
> >> Thanks
> >> Check Abdoul
> >> ------------------
> >>
> >>
> >>
> >
> >
> >
>
>
>


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

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

I’ve actually seen Windows use 800MB of non-paged pool on a 2GB 64-bit
system. If you need larger amounts of non-paged pool, 64-bit is
definitely the way to go (the bulk of the restriction in 32 bit systems
is the limitations on the address space, not on the availability of
memory.)

Regards,

Tony

Tony Mason
Consulting Partner
OSR Open Systems Resources, Inc.
http://www.osr.com

Tony,

I should have been more specific in my response. My experience with
memory limits is with the 32-bit version of Windows. I wrote my response
with 32-bit systems in mind. My bad.

Aaron Stavens
NetMotion Wireless, Inc.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Tony Mason
Sent: Thursday, April 27, 2006 1:59 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] How to allocated more memory ?

I’ve actually seen Windows use 800MB of non-paged pool on a 2GB 64-bit
system. If you need larger amounts of non-paged pool, 64-bit is
definitely the way to go (the bulk of the restriction in 32 bit systems
is the limitations on the address space, not on the availability of
memory.)

Regards,

Tony

Tony Mason
Consulting Partner
OSR Open Systems Resources, Inc.
http://www.osr.com


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

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

To actually *answer* your question, allocate it in paged pool and then
lock it in memory.

Only do something like this in a special purpose environment like a lab
test bench or tightly controlled server farm or something, though. Mass
market products have no business taking up this much memory.

CheckAbdoul wrote:

Hi Group,

My system has 1 GB of memory. I am trying to allocate 127 MB memory in
my driver as follows

pMem = ExAllocatePoolWithTag( NonPagedPool, nSize, MYTAG );

However ExAllocatePoolWithTag() fails for any value greater than 110MB.

Can someone tell me how I should allocate more than 110MB memory?

Thanks
Check Abdoul


Ray

Paged pool VA space is also limited and is not infinite (or nowhere near
== the physical memory in the machine).

d

– I can spell, I just can’t type.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Ray Trent
Sent: Monday, May 01, 2006 1:36 PM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] How to allocated more memory ?

To actually *answer* your question, allocate it in paged pool and then
lock it in memory.

Only do something like this in a special purpose environment like a lab
test bench or tightly controlled server farm or something, though. Mass
market products have no business taking up this much memory.

CheckAbdoul wrote:

Hi Group,

My system has 1 GB of memory. I am trying to allocate 127 MB
memory in
my driver as follows

pMem = ExAllocatePoolWithTag( NonPagedPool, nSize, MYTAG );

However ExAllocatePoolWithTag() fails for any value greater than
110MB.

Can someone tell me how I should allocate more than 110MB memory?

Thanks
Check Abdoul


Ray


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

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

MmAllocatePagesForMdl(…)?

“CheckAbdoul” wrote in message news:xxxxx@ntdev…
> Hi Group,
>
> My system has 1 GB of memory. I am trying to allocate 127 MB memory in
> my driver as follows
>
> pMem = ExAllocatePoolWithTag( NonPagedPool, nSize, MYTAG );
>
> However ExAllocatePoolWithTag() fails for any value greater than 110MB.
>
> Can someone tell me how I should allocate more than 110MB memory?
>
> Thanks
> Check Abdoul
> ------------------
>
>
>

MmAllocateMdlPages is probably more what the OP wants. They can then
map this in chunks as necessary into the system VA space.

-p

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Doron Holan
Sent: Monday, May 01, 2006 2:55 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] How to allocated more memory ?

Paged pool VA space is also limited and is not infinite (or nowhere near
== the physical memory in the machine).

d

– I can spell, I just can’t type.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Ray Trent
Sent: Monday, May 01, 2006 1:36 PM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] How to allocated more memory ?

To actually *answer* your question, allocate it in paged pool and then
lock it in memory.

Only do something like this in a special purpose environment like a lab
test bench or tightly controlled server farm or something, though. Mass
market products have no business taking up this much memory.

CheckAbdoul wrote:

Hi Group,

My system has 1 GB of memory. I am trying to allocate 127 MB
memory in
my driver as follows

pMem = ExAllocatePoolWithTag( NonPagedPool, nSize, MYTAG );

However ExAllocatePoolWithTag() fails for any value greater than
110MB.

Can someone tell me how I should allocate more than 110MB memory?

Thanks
Check Abdoul


Ray


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

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


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

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