Thread: Code crash in vista not in XP

  1. #16
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,793
    >>int sz_NC_WriteField[13];

    >>crash happens in the free() !!

    <slams_on_brakes>

    Your not freeing that array are you?

  2. #17
    Registered User
    Join Date
    Jun 2005
    Posts
    6,815
    Quote Originally Posted by ShashiKantSuman View Post
    And resolved that this cause the crash. (Though I am not able to understand why the crash happens in the free() !!)
    When your code falls off the end of an array (and trying to squeeze 20 values into an array of 13 elements counts) you generally overwrite some area of memory you didn't intend. If that memory happens to be used by free() to manage things internally (for example, keeping track of memory blocks that can be legitimately free()d) then you get a crash in free().

    Quote Originally Posted by ShashiKantSuman View Post
    However, further testing has thrown up new type error. The code crashes while running in release mode, but doesn't during de-bugging. Would welcome any ideas on what can be done ?
    That is another common symptom of pointer molestation. There are many variants. Look for another instance where your code molests a pointer.

    Quote Originally Posted by ShashiKantSuman View Post
    Or let me know if I should attach any section of code?
    No need unless you find a section of code that is contributing to the crash, and don't understand how it might be contributing.

    There are many types of programming errors that can contribute to program crashes, unfortunately.
    Last edited by grumpy; 08-08-2011 at 06:56 AM. Reason: Fixed typo
    Right 98% of the time, and don't care about the other 3%.

    If I seem grumpy or unhelpful in reply to you, or tell you you need to demonstrate more effort before you can expect help, it is likely you deserve it. Suck it up, Buttercup, and read this, this, and this before posting again.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Code runs on Windows 7 but not Vista?
    By gken05 in forum C++ Programming
    Replies: 7
    Last Post: 05-23-2011, 12:51 PM
  2. Update code for Vista 64
    By mdoland in forum C++ Programming
    Replies: 13
    Last Post: 06-02-2008, 04:34 AM
  3. why does my code crash
    By Anddos in forum C++ Programming
    Replies: 5
    Last Post: 01-18-2006, 01:26 PM
  4. crash my code.
    By caroundw5h in forum C Programming
    Replies: 7
    Last Post: 11-06-2005, 12:29 PM
  5. Why this code crash ?
    By MaaSTaaR in forum C Programming
    Replies: 4
    Last Post: 08-22-2005, 10:50 AM