Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / July 2006

Tip: Looking for answers? Try searching our database.

FileStream & MapViewOfFile comparison

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Lloyd Dupont - 30 Jun 2006 16:47 GMT
I need to access big data in a readonly fashion.
I was thinking to open a FileStream and seek and read as needed.
I was wondering if it was worth doing my own FileStream class which would
use internally use MapViewOfFile internally?
Or pehaps a purely managed wrapper which, at least, load the bytes in 4k
memory buffer (and update the buffer everytime I move)?
Mattias Sjögren - 30 Jun 2006 18:25 GMT
Lloyd,

>I was wondering if it was worth doing my own FileStream class which would
>use internally use MapViewOfFile internally?

Have you seen the UnmanagedMemoryStream class in .NET 2.0? It may save
you some work.

There's also a file map helper class available here
http://www.winterdom.com/dev/dotnet/index.html

Mattias

Signature

Mattias Sjögren [C# MVP]  mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.

Lloyd Dupont - 01 Jul 2006 04:07 GMT
interesting link!

> Lloyd,
>
[quoted text clipped - 8 lines]
>
> Mattias
Carl Daniel [VC++ MVP] - 30 Jun 2006 21:34 GMT
>I need to access big data in a readonly fashion.
> I was thinking to open a FileStream and seek and read as needed.
> I was wondering if it was worth doing my own FileStream class which would
> use internally use MapViewOfFile internally?

Most likely, no.  The file system already does read-ahead buffering and
generally will do a better job of managing the memory than you can do in
your application.  Unless your needs are very unusual, it's best to just use
the OS-supplied file buffering - which FileStream will use since it's just a
simple wrapper over the Win32 file I/O operations.

-cd
Lloyd Dupont - 01 Jul 2006 04:08 GMT
thanks!
>>I need to access big data in a readonly fashion.
>> I was thinking to open a FileStream and seek and read as needed.
[quoted text clipped - 8 lines]
>
> -cd

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.