Headache...

BlitzMax Forums/BlitzMax Programming/Headache...

beanage(Posted 2009) [#1]
After doing some further research on my Issue described here http://blitzmax.com/Community/posts.php?topic=88171#1000961 , I think I tracked it down to some bad memory range/array resizing.
I thought I'd fix it by replacing the arrays with pointers and the slices with MemAllocs.

Now, aside some silent crashing, I get randomly two different system errors:
#1: "setMemBit error: membit already set"
#2: "Windows Exception: EXCEPTION_ACCESS_VIOLATION"

The Access Violation always appears at a MemAlloc(), and the IDE DebugStops at this point. I alloc 90 bytes of memory in that line, with approx 12 MB global mem allocation, so it's definately not an out-of-mem error.. but I just dont understand.. why..

May this be due to some other mem allocation (like a stream, or slice) resizing "into" some other critical memory, or .. I am running out of ideas..?


beanage(Posted 2010) [#2]
Let me speak clearer; is it possible that mem slicing/resizing fails, because other mem regions are being corrupted by it?
Kinda:

%= memory
Region A %%%%%%%%%%%%--------------------- -> Reg A's memory will collide with Reg B if resized too far
Region B -------------------------------%%%%%%%%%%%%%%%%%%%%%%%%


I do not have real experience with this low-level stuff, so.. please help.. Otherwise I will be forced to move this to the Beginners Area ;/


*(Posted 2010) [#3]
maybe you should FREE region A before resizing or so you do that already. When coding in C its always good to free ram before resizing so when its reinitialised it can be sorted, resizing ram your asking for problems with buffer overruns and accessing areas of ram you shouldnt as the ram your resizing is already allocated to region A (yes I know its that your trying to resize but as its already there the system will flag it as a problem).


beanage(Posted 2010) [#4]
I cannot free the mem, because I allocate and wire it to hundredth of pointers into it, and I am pretty sure that the pointers are NOT misdirected (which would most likely be the reason for all the errors going on).

My actual Problem is, that I don't have a single MemExtend() line. Are there more BlitzMax Events than these..
- Array Slices
- Banks
- Streams
..that may cause trouble with statically allocated memory?


*(Posted 2010) [#5]
Is there a way that you can see what is in the ram that you have allocated it does seem from the error message that you are allocating ram that is already allocated somewhere and the system is killing your app because of this.