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

What is "Handle Count"

109 100+
Im just wondering what the term Handle count means?
Aug 11 '08 #1
8 13867
Banfa
9,065 Expert Mod 8TB
The count of the number of handles or possibly the count of the number of references to the object acessed via the handle.

Perhaps you could provide some context.
Aug 11 '08 #2
SpecialKay
109 100+
i was just looking for a general meaning. Im looking at some code that is using windows threads. The person that wrote the code said that everytime they call the function abc() they run it on a new thread, and the Handler Count increases. for some reason, this was not expected. They believe that the Handler Count should not have have increased, or should have increased much less then i accually did.
I was not fimilar with the term.
Judging by your definition, it sound to me like the Handler Count increasing is normal. Unfortunatly i dont have more details me self, but i will inquire just how much of an increase we are talking about.
Aug 11 '08 #3
weaknessforcats
9,208 Expert Mod 8TB
When you are inside a function that receives a pointer argument and you need to change the address in the pointer, then you need to delete the memory at the address in the pointer, allocte your new stuff and put the new address in the pointer.

You can't tell from a pointer if:
a) the address in the pointer is to a variable on the stack. If it is and you delete, you crash.
b) the address in the pointer is to a varible on the heap. If it is and you delete, then any copies of that pointer (like in the calling function) are invalid. When you use them, you crash.

So the only safe way to delete a pointer is a) it points to a heap variable and b) you have the last copy of that pointer.

That means, in C, you have to manually keep track of the number of copies of a given pointer. That is, when you call a function, you increment the count. As you leave the function, you decrement the count.The combination of the pointer and the count is called a handle. These would be in a struct.

The count is called a handle (or reference) count.

In C++, you use a handle class: http://bytes.com/forum/thread651599.html.
Aug 11 '08 #4
Banfa
9,065 Expert Mod 8TB
The truth is SpecialKay that handle and handler are very generic terms and their meaning will be and how they are used will be entire dependent on the context they are used in.

In the most generic terms

A handle is an identifier that uniquely identifies some object in a given context without actually allowing direct access to it.

A handler is a piece of code that is run in response to a specific event or message.
Aug 11 '08 #5
SpecialKay
109 100+
so the handle count would be refering to the number of pointers to the variables on each thread. and it would be normal for the handle count to increase. However this handle count, should decrease when the thread is finished. And at the end of the program, the handle count should be 0 otherwise we have a memory leak?
Aug 11 '08 #6
weaknessforcats
9,208 Expert Mod 8TB
so the handle count would be refering to the number of pointers to the variables on each thread. and it would be normal for the handle count to increase. However this handle count, should decrease when the thread is finished. And at the end of the program, the handle count should be 0 otherwise we have a memory leak?
That is correct. It is precisely this logic that allows leak detection software to work.
Aug 12 '08 #7
SpecialKay
109 100+
how would someone see this variable? I assue it is built in to VS?
Aug 12 '08 #8
oler1s
671 Expert 512MB
how would someone see this variable? I assue it is built in to VS?
VS? Handles are a generic programming concept, they have nothing to do with IDEs or Visual Studio. Whether you can see the internal counter depends entirely on how it is exposed or if it is exposed. Without a specific context, API, and code, the most that can be done is talk about the generic concepts involved in handles. When we talk specifics, for example using the C Windows API to get a handle count for a process, we can refer you to http://msdn.microsoft.com/en-us/libr...14(VS.85).aspx.
Aug 12 '08 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: viditm | last post by:
Hi I keep getting the error "Error Creating Windows Handle" in my application and different places in the code. This occurs only to certain users. Its very random and cannot be reproduced in the...
1
by: James | last post by:
Access 2003, trying to count the number of records that meet a criteria. According to Help: "In the Database window, click Queries under Objects, and then click New on the database window...
3
by: Rabun | last post by:
Heres one that is giving me fits ( = = Access newbie), more than likely something simple that I blew right over . . . any help is appreciated - I have a report based on a query, with several...
0
by: chris.bender | last post by:
1. My problem: I am using a query to populate a Chart in MS Access 2k. 2. My query: SELECT .Status, ., Sum(.Amount) AS SumOfAmount, Sum(IIf(!="Debit",!,!*-1)) AS realAmount, Count(.Status) AS...
3
by: Zytan | last post by:
I can handle DoubleClick on a ListBox to respond, not when the selection changes, but when you double click one to invoke an action. This is the same as using the keys to move the selection, then...
5
by: Grant Edwards | last post by:
I'm trying to use the py-gnuplot module on windows, and have been unable to get it to work reliably under Win2K and WinXP. By default, it uses popen(gnuplotcmd,'w'), but in some situations that...
2
by: Jschraepf | last post by:
I'm working in visual web developer and i want to use the results of a count query but i don't know how to get them. I am using a select statment: SELECT Count(Record) From " &...
5
by: gflor16 | last post by:
Problem: I have this code to run a word counter. But I have a problem when I hit the enter key, it doesn't give me any output of how many chars or words. ''' <summary> ''' Returns Word...
2
by: rvarshney | last post by:
Hi All, Sometimes my application crashes with the exception Exception type: System.ComponentModel.Win32Exception Message: Error creating window handle. My Question to you guys are: 1. I am...
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?
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
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...
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
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...

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.