阅读:1614回复:8
关于分配内存的问题
我的驱动程序需要分配出很大的内存。大概需要几百M大小,
我的机器是512M的内存。系统是2000 Server 如果我分配一整块页面内存,最大可以到110M(经过我的反复测试) 我以为是系统中没有一整块比这还大的内存所导致的。 后来我改变策略,每块分配1M,然而我却只能最多分配128块,也就是说我最大只能分配到128M的页面内存。 可是我的系统是有512M内存的,为什么我分配不出256M内存呢?? 哪位高手指点一下! |
|
沙发#
发布于:2003-05-04 02:50
为什么没有人回复呀!
|
|
板凳#
发布于:2003-05-04 22:40
这个以前好像讨论过。
最好是改变你的策略,不要那么大的内存。 |
|
地板#
发布于:2003-05-05 09:04
walt oney的书中也有谈过,不管是分页内存还是非分页内存,128M差不多就是极限。
|
|
|
地下室#
发布于:2003-05-05 11:57
参考inside 2K第7章
Both nonpaged and paged pool start at an initial size based on the amount of physical memory on the system and then grow, if necessary, up to a maximum size computed at system boot time. You can override the initial size of these pools by changing the values NonPagedPoolSize and PagedPoolSize in the registry key HKLM\\SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Memory Management from 0 (which causes the system to compute the size) to the size desired in bytes. You can\'t, however, go beyond the maximum pool sizes listed in Table 7-4. Pool Type Maximum Size Nonpaged 256 MB (128 MB if booted /3GB) Paged 491.875 MB |
|
5楼#
发布于:2003-05-05 14:32
问题是我需要内存搞虚拟内存驱动器呀, 搞不清楚2000都把我的内存搞到哪里去了?
|
|
6楼#
发布于:2003-10-17 11:02
老问题,大家回复一下拉。
|
|
7楼#
发布于:2003-10-17 15:48
老问题,大家回复一下拉。 Give you a link: http://users.compaqnet.be/cn181612/RAMDisk/RAMDisk.htm It is easy to get the information you need. Just type at google.com: free ramdisk drive windows 2000 :) :) :) |
|
8楼#
发布于:2003-10-18 09:04
你可以直接从物理地址空间中分配出乡音大小的 MDL,才将它映射到虚拟地址空间来。像你的 512M 的内存,应该可以划分出 400M 的空间。MmAllocatePagesForMdl()、MmMapLock....、MmGetSystemAddressForMdlSafe().
|
|