[SDL] EXC_BAD_ACCESS errors in OSX / related to SDL??

Nicolas Goy - kuon - 時期精 Nicolas Goy - kuon - 時期精
Sun Dec 17 04:39:25 PST 2006


On 17 Dec 2006, at 02:12, Stephen Anthony wrote:

>
> Exception:  EXC_BAD_ACCESS (0x0001)
> Codes:      KERN_INVALID_ADDRESS (0x0001) at 0x060b1f8e

This error means you try to access memory not allocated.

It has nothing to do with threads.


>
> Note that I can't replicate this on either an Intel iMac or a G5
> PowerMac, but I'm getting users reporting it on a Macbook and a G5
> iMac.  D?!m you Apple for creating so many different
> machines/CPUs/configurations to test.

You are kidding me? Apple vs Windows market. I think it's 100 vs  
billion of config.

And  the error above has nothing to do with the architercture, it is  
a programme bug.


> Note that I've *never* seen
> anything similar on Linux/GP2x/WinCE/Win32/OS2 (the other platforms
> that use this same codebase).

The memory errors are quite vicious, because sometime, you can do an  
error, and this error has no consequence.

I mean, you can do something like:

int *a = malloc(length * 4);
instead of
int *a = malloc(length * sizeof(int)); // Or sizeof(*a)

And this will lead to problem only on 64 bit machines.

You can also do something like:

afunc(float **v) {
	float *a, *b;
	*a = 3.2;
	*b = 5.5;
	v[0] = &a;
	v[1] = &b;
}

main() {
	float **v = malloc(10 * sizeof(float *));
	afunc(v);
	printf("%f\n", *v[0]);
	printf("%f\n", *v[1]);
}

I often see error like this. And, the funny things, is it working...  
until an error occur. And depending of the implementation, and the  
rest of your code. The error can never appear.

So, in your case, it's very difficult to tell. But with bad coding,  
any function in your code can trigger the error. And SDL is likely to  
do so.

You should debug your app to see where the flaw is.

Best regards

-- 
Kuon
CEO - Goyman.com SA
http://www.goyman.com/

"Computers should not stop working when the users' brain does."



-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2434 bytes
Desc: not available
Url : http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20061217/d8164a1d/attachment.bin 


More information about the SDL mailing list