file share problem
-
I would recommend reading the Microsoft article Creating a File Mapping Object[^] Specifically the 'File Mapping Size' section where it states the following: The size of a file mapping object that is backed by a named file is limited by disk space. The size of a file view is limited to the largest available contiguous block of unreserved virtual memory. This is at most 2 GB minus the virtual memory already reserved by the process. Best Wishes, -David Delaune
-
Thank you so much I read the book Programming Applications for Microsoft Windows by Jeffrey Richter but biside file mapping Is there another way to share a big file in one time I always wanna find a better way :)
I think you should re-evaluate your application requirements. Do you *really* need to share 3 Gigabytes of a file between multiple processes? Why not share small sections of the file as needed? Have a look at the sample: Creating a View Within a File[^] You could use a similar technique and share 250 megabytes or more of the file at a time. Best Wishes, -David Delaune
-
I think you should re-evaluate your application requirements. Do you *really* need to share 3 Gigabytes of a file between multiple processes? Why not share small sections of the file as needed? Have a look at the sample: Creating a View Within a File[^] You could use a similar technique and share 250 megabytes or more of the file at a time. Best Wishes, -David Delaune
-
not that problem when I create a file mapping that the file is bigger than 1.5Gb the CreateFileMapping return ERROR_NOT_ENOUGH_MEMORY And I was wondering if I can map a big file (3-4G) to share in one time that's what I want for example I have a 3G file and 100 people wanna read it so I wanna share it that's the situation Thank you !~
Instead of mapping the file to memory, all 100 people can read it from disk using CreateFile and the share flags.
«_Superman_» I love work. It gives me something to do between weekends.
-
I think you should re-evaluate your application requirements. Do you *really* need to share 3 Gigabytes of a file between multiple processes? Why not share small sections of the file as needed? Have a look at the sample: Creating a View Within a File[^] You could use a similar technique and share 250 megabytes or more of the file at a time. Best Wishes, -David Delaune
Just by going thru the link, i understood that, it talks about memory mapping files. But i think process address space is limited to 4GB in 32 bit windows. (2GB-Process; 2GB-Kernel) Hence if you need 3GB of space at a point from your application, you maynot be able to address it. Check for /3GB switch (even though it is not advisable)... which may give you some more information to approach your problem... As Randor pointed, u may have to unmap and map whenever required.
Selva
-
Instead of mapping the file to memory, all 100 people can read it from disk using CreateFile and the share flags.
«_Superman_» I love work. It gives me something to do between weekends.
-
Just by going thru the link, i understood that, it talks about memory mapping files. But i think process address space is limited to 4GB in 32 bit windows. (2GB-Process; 2GB-Kernel) Hence if you need 3GB of space at a point from your application, you maynot be able to address it. Check for /3GB switch (even though it is not advisable)... which may give you some more information to approach your problem... As Randor pointed, u may have to unmap and map whenever required.
Selva
Thank you for reply I care more about speed Only one server almost 3GB index file is to be read by lots of people you know No matter how a program is perfect, slow speed still can't be acceptable Randor's idea is good I don't know the efficiency in this way
-
I just wanna know how to share a big file, 3-4G when using FileMapping, I only can share a file that not bigger than 1.5G if bigger than that, I got an error of ERROR_NOT_ENOUGH_MEMORY Thanks!
Hope you are using Win32 API for this purpose. Windows 32 can maximum support 2xy32(2147483648 bytes) at maximum of 4 GB(2 GB maximum), but practically it is difficult to use the maximun of 2 GB so based on the RAM size and other resources, it varies below 2 GB. So i dont think it will possible in Win 32 to load more than 2 GB with the default /2 G, to support more than 2 GB use the switch of /G as mentioned below, http://technet.microsoft.com/en-us/library/bb124810(EXCHG.65).aspx[^]. :) But such design is not good, either read directly from file as mentioned by randor or enable /3G but none of these are fast. Best is need to have maximum physical memory. :) http://www.padtinc.com/epubs/focus/common/focus.asp?I=34&P=article2.htm[^]
modified on Tuesday, July 21, 2009 4:50 AM
-
I'll second Randor's suggestion - I've used that technique on files about 1GB in size. I actually wrapped the whole mapping thing in a set of custom STL-style iterators that mapped bits of the file in and out on demand. I've got a half-written article on the subject - I'll have to pull my finger out and finish it :-)
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
-
Hope you are using Win32 API for this purpose. Windows 32 can maximum support 2xy32(2147483648 bytes) at maximum of 4 GB(2 GB maximum), but practically it is difficult to use the maximun of 2 GB so based on the RAM size and other resources, it varies below 2 GB. So i dont think it will possible in Win 32 to load more than 2 GB with the default /2 G, to support more than 2 GB use the switch of /G as mentioned below, http://technet.microsoft.com/en-us/library/bb124810(EXCHG.65).aspx[^]. :) But such design is not good, either read directly from file as mentioned by randor or enable /3G but none of these are fast. Best is need to have maximum physical memory. :) http://www.padtinc.com/epubs/focus/common/focus.asp?I=34&P=article2.htm[^]
modified on Tuesday, July 21, 2009 4:50 AM