Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Unhandled win32 Exception: Access Violation Reading Location

    General and Desktop
    2
    2
    3187
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • B
      BrawnyLad last edited by

      I made trivial changes. Now I face an unhandled exception immediately upon the start of a run, even though I am pretty sure I restored everything to the original.

      It appears that the problem occurs at
      @
      void * __cdecl _malloc_base (size_t size)
      ...
      res = _heap_alloc(size);
      @

      When I build I get two warnings:
      "getenv may be unsafe" and "vc100.pdb missing"

      Running in debug I get
      “The inferior stopped because it triggered an exception. Read access violation at :0x0, flags 0x0."

      In the disassembler:
      "0x65396efa <+0x004a> mov ecx,dword ptr [ebx+124h]"

      Any suggestions would be welcomed! I'm stuck!

      1 Reply Last reply Reply Quote 0
      • Jeroentjehome
        Jeroentjehome last edited by

        Hi there,
        First of all the use of malloc is not really a C++ way to go if you ask me. Using the "new" to allocate memory is much more OS independent.
        A couple of questions to ask your self in the code:

        • Did the malloc get the memory requested? (when the system is busy it might even not give you the requested memory)
        • When using the pointer does it point to anything (a NULL returned if the malloc failed).
          Given the warning of the debugger (Read acces violation at 0x0) you probably have a NULL pointer that is used to read or write data with. The OS protects against read/write operations outside the heap and stack of the program.
          Hope this helps, but I would suggest using "new" and "delete" for the memory allocation.
          Greetz

        Greetz, Jeroen

        1 Reply Last reply Reply Quote 0
        • First post
          Last post