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.

File performance

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Cairn - 01 Jul 2006 10:37 GMT
I am opening a number of large files (100 to 900 Mhz) to extact some header
information (500 bytes). watching the memory usage on the task bar when ever
the call Filestream fs = File.Open(filename, Filemode.Open) is called, the
memory usage jumps way beyond that expected (89 Mhz file usage jumps by 400
M). I then use a few fs.Read calls to extract the info required then call
fs.Close and fs.dispose. The memory usage still remains high which can cause
problems as if the number of files checked is large the machine complains
about the amount of memory not available.
Is thier a way to reduce the amount of memory required, surely then amount
of memeory required should be a few bytes as I only require a pointer to the
file.

With thanks.
Carl Daniel [VC++ MVP] - 01 Jul 2006 15:37 GMT
> I am opening a number of large files (100 to 900 Mhz) to extact some
> header information (500 bytes). watching the memory usage on the task
[quoted text clipped - 8 lines]
> amount of memeory required should be a few bytes as I only require a
> pointer to the file.

It is.  There must be something else going on to explain the large memory
consumption.  Exactly how are you opening and reading the files?

-cd
Cairn - 01 Jul 2006 21:57 GMT
As I say in the orginal posting, opening with File.Open, the reading bits of
the file to extract the information I need with filestream.read then closing
with a Filestream.close and a filestream.dispose.

> I am opening a number of large files (100 to 900 Mhz) to extact some header
> information (500 bytes). watching the memory usage on the task bar when ever
[quoted text clipped - 9 lines]
>
> With thanks.
Lloyd Dupont - 03 Jul 2006 02:08 GMT
use using?
as in:
using(FileStream file = File.Open(filename))
{
   // do the file stuff here
}

Signature

Regards,
Lloyd Dupont

NovaMind development team
NovaMind Software
Mind Mapping Software
<www.nova-mind.com>

> As I say in the orginal posting, opening with File.Open, the reading bits
> of
[quoted text clipped - 22 lines]
>>
>> With thanks.
Jon Skeet [C# MVP] - 03 Jul 2006 06:43 GMT
> As I say in the orginal posting, opening with File.Open, the reading bits of
> the file to extract the information I need with filestream.read then closing
> with a Filestream.close and a filestream.dispose.

There's nothing like actually posting real code to make things clear
though.

Could you post a short but complete program which demonstrates the
problem?

See http://www.pobox.com/~skeet/csharp/complete.html for details of
what I mean by that.

Signature

Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet   Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too

Barry Kelly - 03 Jul 2006 07:12 GMT
> I am opening a number of large files (100 to 900 Mhz) to extact some header

BTW, I posted some replies in the .framework.performance newsgroup.

-- Barry

Signature

http://barrkel.blogspot.com/

Göran Andersson - 03 Jul 2006 16:03 GMT
Se my reply in the microsoft.public.dotnet.framework.performance group.

> I am opening a number of large files (100 to 900 Mhz) to extact some header
> information (500 bytes). watching the memory usage on the task bar when ever
[quoted text clipped - 9 lines]
>
> With thanks.

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.