How to Kill arrays???

This is a discussion on How to Kill arrays??? within the C Programming forums, part of the General Programming Boards category; Hello, so I'm having a little problem in my code, which is making the game abort after the 3rd time ...

  1. #1
    Registered User
    Join Date
    Jun 2007
    Location
    Rio de Janeiro, Brasil
    Posts
    48

    Question How to Kill arrays???

    Hello,

    so I'm having a little problem in my code, which is making the game abort after the 3rd time is loading... I'm trying to fix a bug in Quake 2 Evolved.

    I think is something releated of creating these arrays every time that I call that function, and never release them.

    then when I created this for the 3rd time, we have a overflow... I think is something related to that.

    I also check the string, when I load the second map, is the right string there, not first + second string... was my first suspicious...

    there's a way to kill all these vars in the end of the function? how?

    please take a look in my LAST post in this thread!

    Fixing bug in Quake 2 Engine!

    if there's something else that I'm not releasing that can stole ram that could make the game abort, please point me!

    thanks again!

  2. #2
    Mad OnionKnight's Avatar
    Join Date
    Jan 2005
    Location
    Umeň, Sweden
    Posts
    555
    Overflow of what? Local variables need not be freed. What the compiler allocates, it also frees. If you're mallocing just call free()?
    Also allocating too much memory shouldn't cause any problems so I don't think that will solve anything. If you're having buffer overflows you're most likely not having your loop indices set up to be iterated inside the correct range.

  3. #3
    Registered User
    Join Date
    Jun 2007
    Location
    Rio de Janeiro, Brasil
    Posts
    48
    I don't know what's is causing the overflow, please take a look on my code in that link. (last post) and please tell where could have this problem.

    thanks alot!

  4. #4
    Registered User
    Join Date
    Jun 2007
    Location
    Rio de Janeiro, Brasil
    Posts
    48
    I found the line that is killing the game:

    Code:
    free(ptr);
    if I remove this no more abort... it's done!

    now, wth this make the game freeze? when I free per exemple p without problems?

    I rename all vars to hajas_var to make sure they are unique, and still the same...

    any clues?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 16
    Last Post: 01-01-2008, 04:07 PM
  2. How to kill a dragon with various programming languages
    By g4j31a5 in forum A Brief History of Cprogramming.com
    Replies: 7
    Last Post: 10-01-2007, 01:13 PM
  3. Need Help With 3 Parallel Arrays Selction Sort
    By slickwilly440 in forum C++ Programming
    Replies: 4
    Last Post: 11-19-2005, 10:47 PM
  4. Crazy memory problem with arrays
    By fusikon in forum C++ Programming
    Replies: 9
    Last Post: 01-15-2003, 09:24 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21