GetModuleHandle function stack overflow and memory leaks in VC++

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rajatchhibber
    New Member
    • Jan 2010
    • 3

    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(hi nst, iCtrlID);
    //
    more code here
    //
    }
  • Airslash
    New Member
    • Nov 2007
    • 221

    #2
    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.

    Comment

    • rajatchhibber
      New Member
      • Jan 2010
      • 3

      #3
      GetModuleHandle function stack overflow and memory leaks in VC++

      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

      Comment

      • johny10151981
        Top Contributor
        • Jan 2010
        • 1059

        #4
        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

        Comment

        • rajatchhibber
          New Member
          • Jan 2010
          • 3

          #5
          getmodulehandle function stack overflow and memory leaks in vc++

          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.

          Comment

          • Alex Y

            #6
            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_GENTC TR90.DLL>+0x5fc 615a
            01 060cc22c 7c828743 060cc2ec 060cffac 060cc308 ntdll!RtlRaiseS tatus+0xe0
            02 060cc2d4 7c82857e 060c0000 060cc308 060cc2ec ntdll!RtlRaiseS tatus+0xb1
            03 060cc5f4 7c828743 060cc6b4 060cffac 060cc6d0 ntdll!KiUserExc eptionDispatche r+0xe
            04 060cc69c 7c82857e 060c0000 060cc6d0 060cc6b4 ntdll!RtlRaiseS tatus+0xb1
            05 060cc9bc 7c828743 060cca7c 060cffac 060cca98 ntdll!KiUserExc eptionDispatche r+0xe
            06 060cca64 7c82857e 060c0000 060cca98 060cca7c ntdll!RtlRaiseS tatus+0xb1
            07 060ccd84 7c828743 060cce44 060cffac 060cce60 ntdll!KiUserExc eptionDispatche r+0xe
            08 060cce2c 7c82857e 060c0000 060cce60 060cce44 ntdll!RtlRaiseS tatus+0xb1
            09 060cd14c 7c828743 060cd20c 060cffac 060cd228 ntdll!KiUserExc eptionDispatche r+0xe
            0a 060cd1f4 7c82857e 060c0000 060cd228 060cd20c ntdll!RtlRaiseS tatus+0xb1
            0b 060cd514 7c828743 060cd5d4 060cffac 060cd5f0 ntdll!KiUserExc eptionDispatche r+0xe
            0c 060cd5bc 7c82857e 060c0000 060cd5f0 060cd5d4 ntdll!RtlRaiseS tatus+0xb1
            0d 060cd8dc 7c828743 060cd99c 060cffac 060cd9b8 ntdll!KiUserExc eptionDispatche r+0xe
            0e 060cd984 7c82857e 060c0000 060cd9b8 060cd99c ntdll!RtlRaiseS tatus+0xb1
            0f 060cdca4 7c828743 060cdd64 060cffac 060cdd80 ntdll!KiUserExc eptionDispatche r+0xe
            10 060cdd4c 7c82857e 060c0000 060cdd80 060cdd64 ntdll!RtlRaiseS tatus+0xb1
            11 060ce06c 7c828743 060ce12c 060cffac 060ce148 ntdll!KiUserExc eptionDispatche r+0xe
            12 060ce114 7c82857e 060c0000 060ce148 060ce12c ntdll!RtlRaiseS tatus+0xb1
            13 060ce434 7c828743 060ce4f4 060cffac 060ce510 ntdll!KiUserExc eptionDispatche r+0xe
            14 060ce4dc 7c82857e 060c0000 060ce510 060ce4f4 ntdll!RtlRaiseS tatus+0xb1
            15 060ce7fc 7c828743 060ce8bc 060cffac 060ce8d8 ntdll!KiUserExc eptionDispatche r+0xe
            16 060ce8a4 7c82857e 060c0000 060ce8d8 060ce8bc ntdll!RtlRaiseS tatus+0xb1
            17 060cebc4 7c828743 060cec84 060cffac 060ceca0 ntdll!KiUserExc eptionDispatche r+0xe
            18 060cec6c 7c82857e 060c0000 060ceca0 060cec84 ntdll!RtlRaiseS tatus+0xb1
            19 060cef8c 7c828743 060cf04c 060cffac 060cf068 ntdll!KiUserExc eptionDispatche r+0xe
            1a 060cf034 7c82857e 060c0000 060cf068 060cf04c ntdll!RtlRaiseS tatus+0xb1
            1b 060cf354 7c828743 060cf414 060cffac 060cf430 ntdll!KiUserExc eptionDispatche r+0xe
            1c 060cf3fc 7c82857e 060c0000 060cf430 060cf414 ntdll!RtlRaiseS tatus+0xb1
            1d 060cf71c 7c828743 060cf7dc 060cffac 060cf7f8 ntdll!KiUserExc eptionDispatche r+0xe
            1e 060cf7c4 7c82857e 060c0000 060cf7f8 060cf7dc ntdll!RtlRaiseS tatus+0xb1
            1f 060cfae4 7c828743 060cfba4 060cffac 060cfbc0 ntdll!KiUserExc eptionDispatche r+0xe
            20 060cfb8c 7c82857e 060c0000 060cfbc0 060cfba4 ntdll!RtlRaiseS tatus+0xb1
            21 060cffb8 77e6482f 060455f0 00000000 00000000 ntdll!KiUserExc eptionDispatche r+0xe
            22 060cffec 00000000 05fb83f3 060455f0 00000000 kernel32!GetMod uleHandleA+0xdf

            Comment

            Working...