Sometimes I’ll get a memory permission error #000000 (I don’t know exactly how many zeros). There seems to be little rhyme or reason for these crashes. Most of the time, the robot will run fine. The error almost never happens during regular use, only when downloading or switching to autonomous. Even then, it is hit or miss, only occasionally happening. If someone could explain what the errors are and what is causing them that would be great.
ps I am using pointers but they are creating using the new keyword, I don’t copy pointers, and they are deleted in a destructor. I think there should be no wild pointers (do keep in mind, C++ isn’t the language I mainly use, so I could be completely wrong)
It’s caused by a bad pointer or something like that in your code. What programming environment are you using ? I would avoid using new unless you really know what you are doing, just allocate on the stack or globally.
Posting the code would be helpful in this situation.
I’m using PROS. As far as I understand, the new keyword allocates a memory space forever until removed by delete. I’m deleting the pointers in a destructor. The reason that I’m using the new keyword is because PROS has protected default constructors and the assignment operator has been deleted (probably for the feature where you can use the assignment operator to directly set the motor voltage).
At any rate, just so I can cover all my bases, what are all the situations that would cause this error.
Edit: Its not a specific issue so it’s hard to post code. However I do have it all on github.
I asked for the code because something similar happened to our sister team, 574C. Something to do with task management between auton/driver switch. I don’t have significant enough IQ to understand PROS tasks but @marsgate17 might
It doesn’t look like @WChen20’s code is using any functions in okapi that runs into this issue. I’m going to take a closer look at this project tomorrow and see if I can replicate the bug you’re observing.
user code, and the underlying support code, is sharing the same memory space as vexos. If user code tries to write to the memory reserved for vexos operation a memory permission error will happen. The most common cause would be using a NULL pointer, a pointer with a value of 0, you could cause an error with code like this.
uint32_t *ptr = (uint32_t *)0;
*ptr = 1;