Re: Error with Memory Mapped File

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Don't address posts to an individual - this is a newsgroup, not a chat room.

Error 183 (you should learn to look those up) is "Cannot create a file when
that file already exists." My guess is that the file is open by something
else that didn't give compatible sharing when it opened it.


--
Chris Tacke
OpenNETCF Consulting
Managed Code in the Embedded World
www.opennetcf.com
--



"Vinh Nguyen Van" <vinh2b@xxxxxxxxx> wrote in message
news:OBdezhLMHHA.2252@xxxxxxxxxxxxxxxxxxxxxxx


Dear Alex Yakhnin
I has downloaded your source code for Memory Mapped File.
I create a sample:
private static void Test(string fileName)
{
MemoryMappedFileStream mStream = new
MemoryMappedFileStream(fileName, "a", 64,
MemoryProtection.PageReadOnly);
byte[] bff = new byte[10];
mStream.Read(bff, 0, 10);
Console.WriteLine();
}
I debug from source code, I see that:
IntPtr hFile = MemoryMappedFileHelper.CreateFileForMapping(fileName,
Win32FileAccess.GENERIC_READ | Win32FileAccess.GENERIC_WRITE,
Win32FileShare.FILE_SHARE_READ | Win32FileShare.FILE_SHARE_WRITE,
IntPtr.Zero, Win32FileMode.OPEN_ALWAYS,
Win32FileAttributes.FILE_ATTRIBUTE_NORMAL, IntPtr.Zero);

uint lastError = MemoryMappedFileHelper.GetLastError();

lastError = 183

When I continue my app to get some bytes from mapped memory, my app
close automatically.

I develop on C#, NetFX 2.0, pocket pc 2003.
Help me please.
Thanks


*** Sent via Developersdex http://www.developersdex.com ***


.



Relevant Pages

  • Error with Memory Mapped File
    ... I has downloaded your source code for Memory Mapped File. ... When I continue my app to get some bytes from mapped memory, ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: why my apps memory usage reduce to so small
    ... Task manager numbers are largely irrelevant to any form of reality we care about. ... numbers do NOT say how much memory you are using, only how much memory you are using at ... 1M,even more small, i check all of the source code, and can't find any ... memroy useage of my app in the task manager is only 1M,my app doesn't ...
    (microsoft.public.vc.mfc)
  • Re: TSP memory leak
    ... I wrote a little app to monitor our TSP's internal tables, ... memory size as part of the ouput. ... I looked at our source code and didn't find any either! ...
    (microsoft.public.win32.programmer.tapi)
  • Re: How to set up a Linux machine that occupies the minimum memory footprint ?
    ... Of course, if you use 8GB of RAM, or more precisely if you ... Are you saying that if I have a 4GB RAM memory, ... Linux will somehow "know" that it doesn't have ... You've said in another message that your app is ...
    (comp.os.linux.setup)
  • Re: How to set up a Linux machine that occupies the minimum memory footprint ?
    ... Of course, if you use 8GB of RAM, or more precisely if you ... Are you saying that if I have a 4GB RAM memory, ... Linux will somehow "know" that it doesn't have ... You've said in another message that your app is ...
    (comp.os.linux.misc)