473,569 Members | 2,813 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

List of all Instatiated Objects

From within a .NET 1.1 application and using C# Code,
I need to get a list of all the instatiated objects in the application,
with the following columns:

TypeName, Instatiation-Count, Size

I was thinking of using the Garbage Collector somehow or perhaps a Heap and
Stack Dump?
Using an external utility application is NOT an option.
Does anyone have any ideas?

Thank you for any assistance.
Don Stewart
do*@encite.us
Nov 16 '05 #1
6 3140
I might be shooting in the dark here but i think you can get that
information using performance counters...

NuTcAsE

Nov 16 '05 #2
Thanks for NuTcAsE's quick response!

Hi Don,

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that you would like to get all instantiated
objects in the application. If there is any misunderstandin g, please feel
free to let me know.

As far as I know, the current .NET framework didn't expose this kind of
method to us, which means we cannot get that in our applications. I think
the only way for us to achieve that is to use performance counters as
NuTcAsE mentioned.

HTH.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Nov 16 '05 #3
Odd question. The garbage collector is a pretty complex system, and while
there are ways to force it to delete objects, there is no way to guarantee
an object has been deleted. In essence tracking instantiated objects will
involve tracking the garbage collector, which just can't be useful, unless
you are trying to understand how it works. You may need to review what it is
you are trying to do.
"Don Stewart" <do*@encite.u s> wrote in message
news:11******** *****@corp.supe rnews.com...
From within a .NET 1.1 application and using C# Code,
I need to get a list of all the instatiated objects in the application,
with the following columns:

TypeName, Instatiation-Count, Size

I was thinking of using the Garbage Collector somehow or perhaps a Heap
and Stack Dump?
Using an external utility application is NOT an option.
Does anyone have any ideas?

Thank you for any assistance.
Don Stewart
do*@encite.us

Nov 16 '05 #4
Our software has many hundreds of classes and forms
throughout the entire solution. Due to recent Out-of-Memory
and GDI+ Drawing errors and with some manual searching,
I have discovered that there are several classes that were
NOT being Disposed.

We have a fantastic Error-Reporting mechanism
that sends loads of useful information. I want to add a list of
Types that have more than X number of instantiations to these
reports.

There are several reasons that prevent counting each class as
it gets instantiated. Also I really need to see what is actually
going on, even at the System level like Strings.

I have started to look at the Performance Counters to see
if I could find what I'm looking for. I also have found a couple
of API Functions that Get the heap, but this seems somewhat
complicated and warns that it could slow the performance of the
program until it is closed. I may end up using this method
anyways, because it is already throwing errors, and I might as
well get useful debugging info.
PS:
As a side note, I am kinda upset with how the CLR and GC
Dies when it reaches a certain level instead of consuming more
memory. This was obvious during a situation recently where:
on a Server with Dual XEON 3GHz with 4GB of Ram
and "ONLY 1 USER" Logged in! Our application crashed
from Out-Of-Memory errors while using only 301MB of
System Memory. Basically our App only shows Windows
Forms and Controls with not very much behind the scenes
data in Memory. The only applications is installed on the
System was Windows 2000 Server, Citrix and our application.

Thanks for your help.
Don
"Kevin Yu [MSFT]" <v-****@online.mic rosoft.com> wrote in message
news:lc******** ******@TK2MSFTN GXA01.phx.gbl.. .
Thanks for NuTcAsE's quick response!

Hi Don,

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that you would like to get all instantiated
objects in the application. If there is any misunderstandin g, please feel
free to let me know.

As far as I know, the current .NET framework didn't expose this kind of
method to us, which means we cannot get that in our applications. I think
the only way for us to achieve that is to use performance counters as
NuTcAsE mentioned.

HTH.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Nov 16 '05 #5
Our software has many hundreds of classes and forms
throughout the entire solution. Due to recent Out-of-Memory
and GDI+ Drawing errors and with some manual searching,
I have discovered that there are several classes that were
NOT being Disposed.

We have a fantastic Error-Reporting mechanism
that sends loads of useful information. I want to add a list of
Types that have more than X number of instantiations to these
reports.

There are several reasons that prevent counting each class as
it gets instantiated. Also I really need to see what is actually
going on, even at the System level like Strings.

I have started to look at the Performance Counters to see
if I could find what I'm looking for. I also have found a couple
of API Functions that Get the heap, but this seems somewhat
complicated and warns that it could slow the performance of the
program until it is closed. I may end up using this method
anyways, because it is already throwing errors, and I might as
well get useful debugging info.
PS:
As a side note, I am kinda upset with how the CLR and GC
Dies when it reaches a certain level instead of consuming more
memory. This was obvious during a situation recently where:
on a Server with Dual XEON 3GHz with 4GB of Ram
and "ONLY 1 USER" Logged in! Our application crashed
from Out-Of-Memory errors while using only 301MB of
System Memory. Basically our App only shows Windows
Forms and Controls with not very much behind the scenes
data in Memory. The only applications is installed on the
System was Windows 2000 Server, Citrix and our application.

Thanks for your help.
Don

"Evan Mathias" <ev*********@ho tmail.com> wrote in message
news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
Odd question. The garbage collector is a pretty complex system, and while
there are ways to force it to delete objects, there is no way to guarantee
an object has been deleted. In essence tracking instantiated objects will
involve tracking the garbage collector, which just can't be useful, unless
you are trying to understand how it works. You may need to review what it
is you are trying to do.
"Don Stewart" <do*@encite.u s> wrote in message
news:11******** *****@corp.supe rnews.com...
From within a .NET 1.1 application and using C# Code,
I need to get a list of all the instatiated objects in the application,
with the following columns:

TypeName, Instatiation-Count, Size

I was thinking of using the Garbage Collector somehow or perhaps a Heap
and Stack Dump?
Using an external utility application is NOT an option.
Does anyone have any ideas?

Thank you for any assistance.
Don Stewart
do*@encite.us


Nov 16 '05 #6
Hi Don,

It was nice to hear that you have had another approach to this issue. I
think it is feasible. Thanks for sharing your experience with all the
people here. If you have any questions, please feel free to post them in
the community.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Nov 16 '05 #7

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

Similar topics

15
2371
by: oom | last post by:
I am a bit of a newbie when it comes to python, when working with lists today I noticed some very odd behaviour, any suggestions welcome: Python 2.2.3 (#1, Nov 6 2003, 14:12:38) on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> firstlist= >>> secondlist=firstlist >>> print (firstlist,secondlist)
1
3053
by: Glen Able | last post by:
Hi, I have a collection of lists, something like this: std::list<Obj*> lists; Now I add an Obj to one of the lists: Obj* gary; lists.push_front(gary);
3
2005
by: The Other Mike | last post by:
In my existing Powerbuilder application I have several statements that check to make sure an object is instatiated. ie. If isvalid(form1) then.... Is there a way to check for this in VB.NET? I have pasted the definition of IsValid from Powerbuilder. I appologize for being such a newbie.
5
2382
by: Little | last post by:
I have this program and I need to work on the test portion, which tests if a Val is in the list. It returns false no matter what could you look at the part and see what might need to be done to fix it. It reads in the file and sorts out the files into the four different lists. F.txt int main 2 " " help
0
7618
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7926
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8138
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7679
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7983
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6287
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5223
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3647
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1228
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.