Skip to main content
GameDev.net gamedev.net
🔒 Locked

Memory Overwrite Problems

Started by matrix2681 Jun 6, 2006 at 11:33 PM 2 replies 900+ views
Original Post
matrix2681
matrix2681
My program is overwriting some floats. I set up some breaks in .NET to tell me when the problematic var was being changed, and it happens when some OTHER variable is assigned some value... so the 2nd var is affecting the contents of the 1st one. I was always under the impression that floats and ints and basic arrays were isolated from each other, and this machine has more than enough memory for this application. What do I do about this? I don't know how to control where the compiler assigns memory blocks, so what other options do I have? Thanks, Michael
janta
janta
Hi! Are you dealing with pointers, arrays, '&' operator, casting, ar any other bits/memory manipulation ?
Would you mind posting some code, so that someone can figure it out ?

Cheers
Janta
matrix2681
matrix2681
I can show you some general code, because I've been messing with it some and while the problem isn't gone it's not the same code from before:

/* GLOBALS */

float x_1; <---this is the var that's manipulated

struct menunode{
float tlc_x, tlc_y;
};

menunode menus[1];

/* from here on down it's in the main drawing part of the program, and it gets data from those 3 floats */

and when I set up the break to watch x_1, it tripped when menus[1]...

...crap I think I just realized what the problem is. I'm calling menus[1] and it should be menus[0].

Well I hope you didn't think this a waste of time but I'd feel wonky if I just erased all this stuff and said "problem fixed" or something.

So... false alarm I guess. Thanks!
janta
janta
Quote:
Original post by janta
Hi! Are you dealing with pointers, arrays, '&' operator, casting, ar any other bits/memory manipulation ?

Headshot ! :)

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.