weird access violation
hi everyone,
in wrote a program in visual c++ 6.0, and got an access violation exception after writing to a recently allocatd struct.
something like:
p=new struct_c // didn't get NULL here
p->something=value // here i got an access violation
now, i checked the code and found that before these lines i wrote to some address that was not allocated yet. when i fixed this bug, the access violation was gone.
to conclude:
1. i wrote an address that wasn't allocated and got no no error
2. i succeeded to allocated memory for my struct
3. when i wrote to the field of the struct i got the error.
i can't figure out how did the new command gave me an address and yet later i got access violation for using it.
my best guess is that visual c has it's own registration of used memory and the new command uses a different mechanism (??)
anyone has a clue??
Yosi
|