473,385 Members | 1,326 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.

GetModuleHandle function stack overflow and memory leaks in VC++

I am using GetModuleHandle in my function. That function gets called every time I do an operation. I want to know if that function gets called again and again, will the GetModuleHandle cause stack overflow or memory leaks. Thanks.

void Myfunc(int iCtrlID)
{
HINSTANCE hinst = GetModuleHandle("r.dll");
s.LoadString(hinst, iCtrlID);
//
more code here
//
}
Jan 26 '10 #1
5 3565
Airslash
221 100+
put a break point in it and run it in debug mode?
or add some kind of logging function, then you know immediatly when it gets called.
Jan 27 '10 #2
Thanks for the reply Airlash. I know when it is getting called and when the break point is hit. But I am not able to figure out if GetModuleHandle is causing any stack overflow and memory leaks. Can anyone help me answer that. Thanks
Jan 27 '10 #3
johny10151981
1,059 1GB
I would say no stack overflow will not occur even if you call Myfunc zillion time. cause HINSTANCE type variable will be cleared by the c function automatically. But if you ask me to explain I would simply fail. (may be I am wrong)

Regards
Johny
Jan 27 '10 #4
Thanks for the reply. But I want to be sure about it and I can't figure it out. I will appreciate more answers from others. Thanks.
Jan 27 '10 #5
It happens.

Faulting stack below ---
# ChildEBP RetAddr Args to Child
WARNING: Frame IP not in any known module. Following frames may be wrong.
00 060cc208 7c828772 060cc2ec 060cffac 060cc308 <Unloaded_GENTCTR90.DLL>+0x5fc615a
01 060cc22c 7c828743 060cc2ec 060cffac 060cc308 ntdll!RtlRaiseStatus+0xe0
02 060cc2d4 7c82857e 060c0000 060cc308 060cc2ec ntdll!RtlRaiseStatus+0xb1
03 060cc5f4 7c828743 060cc6b4 060cffac 060cc6d0 ntdll!KiUserExceptionDispatcher+0xe
04 060cc69c 7c82857e 060c0000 060cc6d0 060cc6b4 ntdll!RtlRaiseStatus+0xb1
05 060cc9bc 7c828743 060cca7c 060cffac 060cca98 ntdll!KiUserExceptionDispatcher+0xe
06 060cca64 7c82857e 060c0000 060cca98 060cca7c ntdll!RtlRaiseStatus+0xb1
07 060ccd84 7c828743 060cce44 060cffac 060cce60 ntdll!KiUserExceptionDispatcher+0xe
08 060cce2c 7c82857e 060c0000 060cce60 060cce44 ntdll!RtlRaiseStatus+0xb1
09 060cd14c 7c828743 060cd20c 060cffac 060cd228 ntdll!KiUserExceptionDispatcher+0xe
0a 060cd1f4 7c82857e 060c0000 060cd228 060cd20c ntdll!RtlRaiseStatus+0xb1
0b 060cd514 7c828743 060cd5d4 060cffac 060cd5f0 ntdll!KiUserExceptionDispatcher+0xe
0c 060cd5bc 7c82857e 060c0000 060cd5f0 060cd5d4 ntdll!RtlRaiseStatus+0xb1
0d 060cd8dc 7c828743 060cd99c 060cffac 060cd9b8 ntdll!KiUserExceptionDispatcher+0xe
0e 060cd984 7c82857e 060c0000 060cd9b8 060cd99c ntdll!RtlRaiseStatus+0xb1
0f 060cdca4 7c828743 060cdd64 060cffac 060cdd80 ntdll!KiUserExceptionDispatcher+0xe
10 060cdd4c 7c82857e 060c0000 060cdd80 060cdd64 ntdll!RtlRaiseStatus+0xb1
11 060ce06c 7c828743 060ce12c 060cffac 060ce148 ntdll!KiUserExceptionDispatcher+0xe
12 060ce114 7c82857e 060c0000 060ce148 060ce12c ntdll!RtlRaiseStatus+0xb1
13 060ce434 7c828743 060ce4f4 060cffac 060ce510 ntdll!KiUserExceptionDispatcher+0xe
14 060ce4dc 7c82857e 060c0000 060ce510 060ce4f4 ntdll!RtlRaiseStatus+0xb1
15 060ce7fc 7c828743 060ce8bc 060cffac 060ce8d8 ntdll!KiUserExceptionDispatcher+0xe
16 060ce8a4 7c82857e 060c0000 060ce8d8 060ce8bc ntdll!RtlRaiseStatus+0xb1
17 060cebc4 7c828743 060cec84 060cffac 060ceca0 ntdll!KiUserExceptionDispatcher+0xe
18 060cec6c 7c82857e 060c0000 060ceca0 060cec84 ntdll!RtlRaiseStatus+0xb1
19 060cef8c 7c828743 060cf04c 060cffac 060cf068 ntdll!KiUserExceptionDispatcher+0xe
1a 060cf034 7c82857e 060c0000 060cf068 060cf04c ntdll!RtlRaiseStatus+0xb1
1b 060cf354 7c828743 060cf414 060cffac 060cf430 ntdll!KiUserExceptionDispatcher+0xe
1c 060cf3fc 7c82857e 060c0000 060cf430 060cf414 ntdll!RtlRaiseStatus+0xb1
1d 060cf71c 7c828743 060cf7dc 060cffac 060cf7f8 ntdll!KiUserExceptionDispatcher+0xe
1e 060cf7c4 7c82857e 060c0000 060cf7f8 060cf7dc ntdll!RtlRaiseStatus+0xb1
1f 060cfae4 7c828743 060cfba4 060cffac 060cfbc0 ntdll!KiUserExceptionDispatcher+0xe
20 060cfb8c 7c82857e 060c0000 060cfbc0 060cfba4 ntdll!RtlRaiseStatus+0xb1
21 060cffb8 77e6482f 060455f0 00000000 00000000 ntdll!KiUserExceptionDispatcher+0xe
22 060cffec 00000000 05fb83f3 060455f0 00000000 kernel32!GetModuleHandleA+0xdf
Oct 14 '10 #6

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

Similar topics

7
by: Aguilar, James | last post by:
Hello all, To begin, yes, this -is- a homework assignment. However, it is for my Algorithms class, and my instructor has given us explicit permission to use "expert" groups like newsgroups, so...
4
by: Victor | last post by:
Hello, I've got a situation in which the number of (valid) recursive calls I make will cause stack overflow. I can use getrlimit (and setrlimit) to test (and set) my current stack size. ...
21
by: Joakim Hove | last post by:
Hello, I have implemented a small library with a function a datatype to manage temporary storage, and handle out correctly casted storage. The function to get a double pointer is for instance: ...
0
by: Frank Lopez | last post by:
Does anyone know if Microsoft generated a whitepaper on this topic? Does anyone know what the solution is? (meaning, eliminate the leak problem -- I am seeing three memory leaks from...
1
by: Marco Gerlach | last post by:
Hello, on one of our customers servers we get following error on first ASPX-page: An error occurred while try to load the string resources (GetModuleHandle failed with error -2147023888) ...
4
by: PL | last post by:
Hi everyone, I was surprised to see memory leaks in our application when it crashed today. Basically, the code is written in C#, but with c# and C++ DLLS; its the latter (managed extensions) that...
7
by: amit.atray | last post by:
Environement : Sun OS + gnu tools + sun studio (dbx etc) having some Old C-Code (ansi + KR Style) and code inspection shows some big size variable (auto) allocated (on stack) say for ex. char...
3
by: jack113256 | last post by:
Hi everyone: I have a question in using Callback function, there is my code: /******* code start *********/ #include <stdio.h> void a(); void b(); void run();
1
by: George2 | last post by:
Hello everyone, Such code segment is used to check whether function call or exception- handling mechanism runs out of memory first (written by Bjarne), void perverted() { try{
2
by: Iamrashmin | last post by:
I have converted VC6 project to .Net 2005 VC++. It gives me warning : warning C4717: 'CExcel::PrintLine' : recursive on all control paths, function will cause runtime stack overflow void...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
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...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: 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
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
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...

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.