Thread: First-chance exception in app.exe (KERNEL32.DLL): 0xC0000005: Access Violation.

  1. #1
    Distributed Programming beyonddc's Avatar
    Join Date
    Dec 2001
    Location
    Mass
    Posts
    31

    First-chance exception in app.exe (KERNEL32.DLL): 0xC0000005: Access Violation.

    Anyone recieve this error before?
    My program can compile and run, but when I try to use the debugger to debug it, it gave me this error.

    First-chance exception in BEYONDDC.exe (KERNEL32.DLL): 0xC0000005: Access Violation.

    It is very frustrating, and I don't know what to do w/ it.
    It was all fine last night too, it just happened today, and I did no change on it. I restarted my computer couple of times already, and it is no help.

  2. #2
    Distributed Programming beyonddc's Avatar
    Join Date
    Dec 2001
    Location
    Mass
    Posts
    31
    Originally posted by Salem
    Should be on the windows board
    Have you tried google
    I tried google before coming here. I want to know why it is causing it....

  3. #3
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    Look in groups.google.com:
    http://groups.google.com/groups?hl=e...com%26rnum%3D1
    http://groups.google.com/groups?sour...n+KERNEL32.DLL
    Your answer is in there, just keep on reading
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  4. #4
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,868
    AFAIK this is due to your app having a memory error. Your app uses memory that is not its.

    That is it is a 'symptom' of a potentially greater error.

    When the system tries to free or use the memory it finds can't and returns the error. In the protected debugger all is well. If the memory was not in use or there is plenty of free memory not much happens. If the memory contains important info or there is no free memory the system can crash.

    They can be caused by dangling pointers, going out of bounds in an array (or string) ect. It is not causing a crash but may on other systems depending on what that memory contained.

    IMHO you should track down and eliminate these errors.

    In your MSVC debugger (.NET)
    under [DEBUG] select [EXCEPTIONS...]
    in the treeview expand [WIN32 Exceptions],
    find the c0000005 exception and highlight,
    at the bottom select [Break into the debugger] in both the 'thrown' and 'handled' group boxes.

    This MAY help find the error but I would not trust it to find all of them.

    You will have to run the debugger looking slowly isolating the exception until you find where it happens then try to back track (if needed) to the error.
    The exception may occur when the error occurs
    or
    where the memory (accessed incorrectly) is used again.

  5. #5
    Distributed Programming beyonddc's Avatar
    Join Date
    Dec 2001
    Location
    Mass
    Posts
    31
    Thank you guys, let me look into it more deeply. I hope I can find where the problem is occuring exactly.

    so far, I have tracked down the location when it crashed..


    Code:
    char *todayitem[100]; //this is a variable inside the class.
    
    void CMAININTERFACE::add_todayitem(int r, int t){
    LVITEM *lvi=new LVITEM();
    for(int i = 0; i<r; i++)
    {
         lvi->mask =  LVIF_TEXT;
         lvi->iItem = i;
         lvi->iSubItem = 0;
         if(t==0)lvi->pszText = "Task";
         if(t==1)lvi->pszText = "Event";
         m_dlg_list.InsertItem(lvi);
         lvi->iSubItem =1;
         lvi->pszText = todayitem[i];
         m_dlg_list.SetItem(lvi);
         lvi- pszText = id[i];
         lvi->iSubItem =2;
         m_dlg_list.SetItem(lvi);//this is the location where it crashes.
    }
    
    delete lvi;
    }
    Last edited by beyonddc; 07-13-2003 at 01:04 PM.

  6. #6
    Distributed Programming beyonddc's Avatar
    Join Date
    Dec 2001
    Location
    Mass
    Posts
    31
    Originally posted by novacain
    In your MSVC debugger (.NET)
    under [DEBUG] select [EXCEPTIONS...]
    in the treeview expand [WIN32 Exceptions],
    find the c0000005 exception and highlight,
    at the bottom select [Break into the debugger] in both the 'thrown' and 'handled' group boxes.

    This MAY help find the error but I would not trust it to find all of them.

    I'm using MS VC++ 6.0 though, how do I set that up in VC++6?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Stack trace for access violation
    By locksleyu in forum C++ Programming
    Replies: 2
    Last Post: 12-11-2008, 03:01 PM
  2. Malloc access violation
    By JOCAAN in forum C Programming
    Replies: 7
    Last Post: 11-30-2008, 04:47 AM
  3. Replies: 3
    Last Post: 07-17-2008, 08:45 AM
  4. Help! Access violation error in C++
    By runlevel007 in forum C++ Programming
    Replies: 2
    Last Post: 03-18-2003, 07:56 PM
  5. 0xC0000005: Access Violation
    By Strider in forum Windows Programming
    Replies: 3
    Last Post: 11-07-2001, 02:46 PM