[Mono-devel-list] System.IO.FileStream patch

Ben Maurer bmaurer at users.sourceforge.net
Thu Jun 19 17:43:08 EDT 2003


I noticed while doing some IO stuff that when FileStream is created it
always allocates a buffer, even if not necessary. For example, if the
user allocates a large buffer for use by the read method, it is
unnecessary to allocate the FileStream buffer.

Some real life examples of this would be tools that read data from a lot
of files, such as a compression tool, or a compiler.

This patch solves that issue by allocating the buffer on first use. All
the System.IO tests that were previously green are still green with this
patch. As a test for its effectiveness, I tested with the monodoc
assembler. It was able to reduce the memory consumption of the program
by 15 MB.

-- Ben
-------------- next part --------------
A non-text attachment was scrubbed...
Name: FileStream.cs.patch
Type: text/x-patch
Size: 4594 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20030619/a25c5401/attachment.bin 

More information about the Mono-devel-list mailing list