Sign in to follow this  
matrix2681

Memory Overwrite Problems

Recommended Posts

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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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!

Share this post


Link to post
Share on other sites
Quote:
Original post by janta
Hi! Are you dealing with pointers, arrays, '&' operator, casting, ar any other bits/memory manipulation ?

Headshot ! :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this