|
-
October 19th, 2004, 02:53 AM
#1
what is top size of memory-mapped file?
Hi,guys...
I had sucessfully used memory-mapped file on small file many times...but yesterday when i used it on 729M file,it failed...the code is following...what should i do to corret the code...thx in advance.
Code:
HANDLE hFile = ::CreateFile (pFileName, GENERIC_READ,
FILE_SHARE_READ, NULL, OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL, 0);
if ( hFile == INVALID_HANDLE_VALUE ) {
return FALSE;
}
DWORD dwSizeHi;
m_dwFileSize = ::GetFileSize(hFile, &dwSizeHi);
HANDLE hFileMapping = ::CreateFileMapping(hFile, NULL, PAGE_READONLY,0, 0, NULL);
if ( hFileMapping == NULL ) {
::CloseHandle(hFile);
return FALSE;
}
m_p = (LPBYTE)::MapViewOfFile(hFileMapping, FILE_MAP_READ,
0, 0, 0);
::CloseHandle(hFile);
::CloseHandle(hFileMapping);
if ( m_p == NULL ) {
DWORD dwError = GetLastError();
return FALSE;
}
pFileName was file name,
i mapped the 729M file...m_p == NULL was TRUE;then dwError was 8,it stand for no enough memory...BTW.My memory size was 256M; OS was Windows 2000 server.
Regards,
Ephemera
Last edited by ephemera; October 19th, 2004 at 02:55 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|