473,404 Members | 2,137 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

RichTextBox requires tons of memory for text

VS.NET 2K3 and .NET 1.1

I'm having a problem with RichTextBox allocating huge amounts of memory for
text. I have recreated the problem in the attached sample which, when the
button is pressed, will create a ~33MB file and load it into the
RichTextBox.

If you watch the memory in Task Manager, before the button it consumes ~15MB
max, but after it's finished, the memory is upwards of 140MB. Immediately
invoking the GC doesn't seem to help. I've tried different things to no
avail.

Strangely enough, if I minimize the window, or maximize and restore, it will
go down to something I could at least understand.

I thought it might be related to http://support.microsoft.com/?kbid=826981,
which fix was included in the recently released SP1. I retested the issue
using the service pack, but it's still there.

What can I do to fix this?

================================================== ==
Walter Williams
Software Engineer
Sawtooth Software, Inc.
http://www.sawtoothsoftware.com
----------------------------------------------------
"Do, or do not. There is no try."

Jul 21 '05 #1
1 1808
This is not a .NET issue, but the normal behavior of the RichTextBox
control, the memory is taken from the unmanaged heap. Just load your
textfile into Wordpad (don't even try to load it in Winword as it exceeds
the number of pages Word can handle), make sure to scroll to the last line
and watch the bytes used in taskman.
Willy.
"Walter L. Williams" <wa**@misspelled.sawtoothsotfvare.com> wrote in message
news:%2******************@TK2MSFTNGP09.phx.gbl...
VS.NET 2K3 and .NET 1.1

I'm having a problem with RichTextBox allocating huge amounts of memory
for text. I have recreated the problem in the attached sample which, when
the button is pressed, will create a ~33MB file and load it into the
RichTextBox.

If you watch the memory in Task Manager, before the button it consumes
~15MB max, but after it's finished, the memory is upwards of 140MB.
Immediately invoking the GC doesn't seem to help. I've tried different
things to no avail.

Strangely enough, if I minimize the window, or maximize and restore, it
will go down to something I could at least understand.

I thought it might be related to
http://support.microsoft.com/?kbid=826981, which fix was included in the
recently released SP1. I retested the issue using the service pack, but
it's still there.

What can I do to fix this?

================================================== ==
Walter Williams
Software Engineer
Sawtooth Software, Inc.
http://www.sawtoothsoftware.com
----------------------------------------------------
"Do, or do not. There is no try."

Jul 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: John Broderick | last post by:
I've got a problem with the RichTextBox control in .Net where the garbage collector doesn't reclaim its memory after I've finished with it. My program adds a series of rtb's to the control array...
2
by: KenH | last post by:
I am getting an unhandled system exception while writing to a RichTextBox. The process may run for a few hours or days before the error is generated The message is "Cannot access a disposed object...
3
by: kangoo | last post by:
Hi, I'm trying to remove the last charater in a richTextBox. I though richTextBox.Text.Remove(richTextBox.Text.length-1, 1); would work, but it does nothing (eg richTextBox.Text += "some new...
0
by: Matt | last post by:
This took way to long to figure out - now that I have it working I thought I would share with the group. I've seen tons of posts with very little good answers on this seemingly simple thing that...
1
by: Walter L. Williams | last post by:
VS.NET 2K3 and .NET 1.1 I'm having a problem with RichTextBox allocating huge amounts of memory for text. I have recreated the problem in the attached sample which, when the button is pressed,...
0
by: Vincent | last post by:
Dear all, I have implemented a class to export the content of RichTextBox to image in WYSISYG mode so that line breaks on the screen are the same as exported. C# Code: public struct...
9
by: James Wong | last post by:
Hi, I use the RichTextBox in my program. It will use different language in this RichTextBox (chinese and english characters), and it set the "DualFont" and use different fonts. By the way, how...
8
by: =?Utf-8?B?bWljaGFlbCBzb3JlbnM=?= | last post by:
I have created a Control that extends RichTextBox to do syntax-hilighting. My strategy is to have a timer that restarts every time a user types a key so that it can wait until the user pauses for...
4
by: =?Utf-8?B?UmF5IE1pdGNoZWxs?= | last post by:
Hello, I have a multiline RichTextBox that I use for data logging. I'm concerned about how the AppendText method reacts when over time the maximum number of characters have been added. Do the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.