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

Thread memory consumption

My .NET 1.1 program allocates many Threads that loop making database calls
and other stuff.

Thread1 = new Thread(new ThreadStart(this.Thread1));
Thread1.Start();

Thread2 = new Thread(new ThreadStart(this.Thread2));
Thread2.Start();

while(true){
Thread.Sleep(1000);
}

How can I tell how much memory each Thread is consuming, and distinguish
which one is taking the most ?.

(I would like to create memory counters for perfmon)

thanks B.



Mar 26 '08 #1
2 7704
Brian Stoop wrote:
My .NET 1.1 program allocates many Threads that loop making database calls
and other stuff.

Thread1 = new Thread(new ThreadStart(this.Thread1));
Thread1.Start();

Thread2 = new Thread(new ThreadStart(this.Thread2));
Thread2.Start();

while(true){
Thread.Sleep(1000);
}

How can I tell how much memory each Thread is consuming, and distinguish
which one is taking the most ?.
Threads do not consume memory (aside from their stack, which is
constant-sized); processes consume memory. The whole point of threads is
that they share process state.

If your threads do have a sense of "ownership" of objects and you want to
keep track of which thread is allocating the most of these objects, you'll
have to keep track of that yourself when you create them.

--
J.
Mar 26 '08 #2
"Jeroen Mostert" <jm******@xs4all.nlwrote in message
news:47***********************@news.xs4all.nl...
Brian Stoop wrote:
>My .NET 1.1 program allocates many Threads that loop making database
calls and other stuff.

Thread1 = new Thread(new ThreadStart(this.Thread1));
Thread1.Start();

Thread2 = new Thread(new ThreadStart(this.Thread2));
Thread2.Start();

while(true){
Thread.Sleep(1000);
}

How can I tell how much memory each Thread is consuming, and distinguish
which one is taking the most ?.
Threads do not consume memory (aside from their stack, which is
constant-sized); processes consume memory. The whole point of threads is
that they share process state.
Agreed, but keep in mind that CLR threads have their stack space set to
(comitted by the CLR) 1MB (4MB for 64 bit code threads) per default.
Creating a few hundred threads may bite you real hard ;-).

Willy.

Mar 26 '08 #3

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

Similar topics

10
by: Marty | last post by:
Hi, Does anybody is experiencing a lot of RAM consumption when using many threads ? If yes, how can we reduce that level of used memory? Thanks tou! Marty
1
by: anandav2001 | last post by:
Hello developers, I have created an executable(system tray application) in VS.net 2003 using VB.net. My app was taking 30 MB memory(since some web services call are there which happens for each...
8
by: Raja Gregory | last post by:
Hi All, I have developed a server application in C#. While running this application, it is not running more than 30 minutes due to memory leak. Could you tell me what will be the problem?
2
by: va_acharya | last post by:
I have a timer control on a windows form. From the tick event(t1_tick) i am creating an object of a thread which is calling a function test(), which is an empty function void test(){}. Timer...
12
by: Tony | last post by:
Hi expert, I installed DB2 v8.2 server on Solaris 9 box. When I connect to DB2 using control centre or other applications(except command line), around 12 db2sysc processes pop up and each one...
1
by: buu | last post by:
It's strange to me, but, create a dictionary and fill it with 1 mil. of some objects. then, see the memory consumption (arised, of course). then, clean the dictionary.... memory consumption is...
2
by: =?Utf-8?B?SGFubmVzIFN0ZWlua2U=?= | last post by:
Hello, I'm trying to use the command "#pragma omp parallel for" within a thread but each thread that is created (and stopped again) produces a memory leak of about 44kB. If the entry for...
34
by: Creativ | last post by:
Why does Thread class not support IDisposable? It's creating quite some problem. Namely, it can exhaust the resource and you have not control over it.
17
by: Cesar | last post by:
Hello people. I'm having a Winform app that contains a webbrowser control that keeps navigating from one page to another permanentrly to make some tests. The problem I'm having is that after a...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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,...

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.