473,322 Members | 1,268 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,322 software developers and data experts.

Insane System.String Memory usage

I recently ran our code through a profiler to determine why it was
using so much memory. It turns out the System.String object is taking
95% of the memory. We have considered converting the strings to
StringBuilder objects, but I don't think this will help. From what I
understand, the StringBuilder only helps with speed increases (by
reducing time to create a new string). In addition to that, most of
the string manipulations are very small/short.

It seems like the System.String objects are not getting released. Any
idea why? Any tips to reduce the memory usage? Thanks.
Nov 22 '05 #1
2 2621
Zach,
It seems like the System.String objects are not getting released. Any
idea why? Any tips to reduce the memory usage? Thanks. It really depends on how & what you are doing with the strings. Without
seeing your code, or a small sampling of your typical code, I'm not sure any
one here can really answer your question.
From what I
understand, the StringBuilder only helps with speed increases (by
reducing time to create a new string). It reduces the time by avoiding creating a new string altogether, Remember
if you avoid creating a new string, then you reduce the memory that
System.String uses. It really depends on how & why you are creating new
strings if StringBuilder will help or not.

Hope this helps
Jay
"Zach Tong" <po*********@gmail.com> wrote in message
news:21**************************@posting.google.c om...I recently ran our code through a profiler to determine why it was
using so much memory. It turns out the System.String object is taking
95% of the memory. We have considered converting the strings to
StringBuilder objects, but I don't think this will help. From what I
understand, the StringBuilder only helps with speed increases (by
reducing time to create a new string). In addition to that, most of
the string manipulations are very small/short.

It seems like the System.String objects are not getting released. Any
idea why? Any tips to reduce the memory usage? Thanks.

Nov 22 '05 #2
They aren't released as long as you hold a reference to it. Without seeing
any code it's hard to tell why references are held.
I suggest you post a complete sample that illustrate your findings.

Willy.

"Zach Tong" <po*********@gmail.com> wrote in message
news:21**************************@posting.google.c om...
I recently ran our code through a profiler to determine why it was
using so much memory. It turns out the System.String object is taking
95% of the memory. We have considered converting the strings to
StringBuilder objects, but I don't think this will help. From what I
understand, the StringBuilder only helps with speed increases (by
reducing time to create a new string). In addition to that, most of
the string manipulations are very small/short.

It seems like the System.String objects are not getting released. Any
idea why? Any tips to reduce the memory usage? Thanks.

Nov 22 '05 #3

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

Similar topics

2
by: tomvr | last post by:
Hello I have noticed some 'weird' memory usage in a vb.net windows app The situation is as follows I have an app (heavy on images) with 2 forms (actually there are more forms and on starting...
2
by: Zach Tong | last post by:
I recently ran our code through a profiler to determine why it was using so much memory. It turns out the System.String object is taking 95% of the memory. We have considered converting the...
2
by: Tony | last post by:
tHi, I have application with memory leaks and I used .Net memory profiler. It showed that every time I use string, gc does not clear that string and at the end I have many instances and bytes...
9
by: Niels Dekker - no reply address | last post by:
Are all the following initializations semantically equivalent? wchar_t a = {L'\0'}; wchar_t b = {'\0'}; wchar_t c = {0}; wchar_t d = {}; If so, why don't we all use an empty initializer...
7
by: Malcolm | last post by:
This is a program to convert a text file to a C string. It is offered as a service to the comp.lang.c community. Originally I thought it would be a five minute job to program. In fact there are...
2
by: miguel | last post by:
Hi, I have created a service which parses real-time prices from one format into another. This is all working very quickly and nicely, however, I have recently found that the memory usage is...
41
by: Baron Samedi | last post by:
I want to produce a piece of software for embedded systems, generally telecoms based, mostly running on ARM processors, but I can't guarantee that, of course. My software should work along with...
232
by: robert maas, see http://tinyurl.com/uh3t | last post by:
I'm working on examples of programming in several languages, all (except PHP) running under CGI so that I can show both the source files and the actually running of the examples online. The first...
1
by: rose.kevin | last post by:
Hi I am trying to make a little tool tip box pop up when you hover the mouse over one of our custom filetypes in Windows explorer. And it is slowly driving me insane. I have a created a dll,...
1
by: Jean-Paul Calderone | last post by:
On Tue, 22 Apr 2008 14:54:37 -0700 (PDT), yzghan@gmail.com wrote: The test doesn't demonstrate any leaks. It does demonstrate that memory usage can remain at or near peak memory usage even after...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.