473,671 Members | 2,121 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Count of objects instantiated?

Is there any function in the CLR that can give me a count, by type, of
the number of objects currently instantiated?
--
Philip Daniels
Aug 30 '06 #1
3 1165
Hello, Philip!

PDIs there any function in the CLR that can give me a count, by type, of
PDthe number of objects currently instantiated?

In order to know that - you'll have to use Profiling API.

Look at for more details
( http://msdn.microsoft.com/msdnmag/issues/01/12/hood/ )
( http://www.blong.com/Conferences/DCo.../Profiling.htm )

Or if you want to know the instances number of your custom type, then
you can create objects factory, where necessary count tracking will be
implemented...
--
Regards, Vadym Stetsyak
www: http://vadmyst.blogspot.com
Aug 30 '06 #2
On Wed, 30 Aug 2006 15:43:25 +0300, "Vadym Stetsyak" <va*****@ukr.ne t>
wrote:
>Hello, Philip!

PDIs there any function in the CLR that can give me a count, by type, of
PDthe number of objects currently instantiated?

In order to know that - you'll have to use Profiling API.
Thanks, Vadym, that was quick.

Had a quick look, and ICorProfilerCal lback::ObjectsA llocatedByClass
looks handy. Basically what I would be interested in is tracking
object allocations and garbage collections over time to see if there
are any object leaks. Not sure if it can do the garbage collections
part of that though...

>Look at for more details
( http://msdn.microsoft.com/msdnmag/issues/01/12/hood/ )
( http://www.blong.com/Conferences/DCo.../Profiling.htm )

Or if you want to know the instances number of your custom type, then
you can create objects factory, where necessary count tracking will be
implemented. ..
Yeah, done that in the past but it's too invasive for my liking.
--
Philip Daniels
Aug 30 '06 #3
Hello, Philip!

PDHad a quick look, and ICorProfilerCal lback::ObjectsA llocatedByClass
PDlooks handy. Basically what I would be interested in is tracking
PDobject allocations and garbage collections over time to see if there
PDare any object leaks. Not sure if it can do the garbage collections
PDpart of that though...

ClrProfiler is doing that. Source code of ClrProfiler is available, you can
dig in there and try to find out how it tracks gc collecitons...

--
Regards, Vadym Stetsyak
www: http://vadmyst.blogspot.com
Aug 30 '06 #4

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

Similar topics

3
2232
by: phil | last post by:
Using Tkinter Canvas to teach High School Geometry with A LOT of success. My drawing gets very slow after a lot of actions. For instance I have created code to rotate a set of objects about a rotation point. rotate 360 degrees starts to get slow after 720 degrees its crawling.
6
3143
by: Don Stewart | last post by:
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?
2
2268
by: FredC | last post by:
S Name Microsoft Windows XP Professional Version 5.1.2600 Service Pack 2 Build 2600 Total Physical Memory 1,024.00 MB MDE 2003 Version 7.1.3008 ..NET Framework 1.1 Version 1.1.4322 SP1 Microsoft Visual C# .NET 69462-335-0000007-18707 Crystal Reports for Visual Studio .NET AAP50-GS0000S-WCK00C3 The code below shows the instantiation of multiple V47 objects. These
6
1573
by: Mariano | last post by:
Hi, I have stored a menu in a database. The menu is dynamically updated and last level menu items contain the object type that should be instantiated. I am looking for a way to instantiate the object dynamically without an enormous select case statement. I can't find nothing in the docs... Any ideas? To make things clear, what I want to do is something like this: dim objType as new String("CustomerObject") dim obj as new objType
3
1992
by: Miguel | last post by:
Hi, I'm new to .NET and am using VB .NET as I am from a VB background. I am having difficulty understanding the way .NET handles, passes and uses objects. I have had a look at the Micrsoft Data Access Application blocks for .NET and am struggling to understand the following: 1. When creating a function that returns a datareader, there is a datareader instantiated inside the function. This datareader is then returned to the
8
1854
by: Lüpher Cypher | last post by:
Hi, Suppose we have a hierarchical class structure that looks something like this: Object | +-- Main | +-- Object1
1
1150
by: Thom Anderson | last post by:
Hi, I have some business objects that are pretty simple. They get instantiated and have a few properties, methods, and events. The business objects talk to the database directly or access web services. But 99% of the time when they are instantiated or initially used, they access a database and receive a datatable. Can someone show me how to do the following; 1) cache the business object in a way that it gets used by all of the users...
9
3800
by: Simon Woods | last post by:
Hi I have a factory class which I want to use to create new objects which inherit a certain base type so I have a declaration Public Class MyOwnFactory(Of T As MyOwnBase) As I understand it, a new MyOwnFactory will get instantiated for every different type of class implementing MyOwnBase. (This is what I want anyway as the factory is holding a cache of previously created objects
9
2976
by: smarttechie | last post by:
Hii all please help its urgent i have developed an application in xsl. what i want to do is i m searching the xml file based on a search.and based on that search im creating one tree like structure. in this tree structure i need the count of siblings in each level. im not getting the count exactly the same the xslt file ----------------- <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0"...
0
8476
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8393
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8914
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8598
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
8670
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7433
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6223
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4406
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2051
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.