Unmapped memory errors...

When I run some of my Mac OpenGL apps (coded using GLUT) they sometimes crash. This has become more and more of a problem. The problem occurs during the loading of textures using TK to load RGB images. If I am running the debugger when it crashes it says that it was an unmapped memory error. Then when I look through the memory addresses of the GLuints which I am using to store the index to the texture it says “register not available” where it normally says the address. What’s going on here? Note on hardware & software: A 233Mhz iMac (Rev B) w/MacOS 8.6, OpenGL version 1.1.2 & 1.1.3 (I have tried both versions with the same results), and CodeWarrior Pro 5 as my compiler. Sometimes the apps work fine though. Any help would be appreciated.

Morgan

Originally posted by Morgan:
[b]When I run some of my Mac OpenGL apps (coded using GLUT) they sometimes crash. This has become more and more of a problem. The problem occurs during the loading of textures using TK to load RGB images. If I am running the debugger when it crashes it says that it was an unmapped memory error. Then when I look through the memory addresses of the GLuints which I am using to store the index to the texture it says “register not available” where it normally says the address. What’s going on here? Note on hardware & software: A 233Mhz iMac (Rev B) w/MacOS 8.6, OpenGL version 1.1.2 & 1.1.3 (I have tried both versions with the same results), and CodeWarrior Pro 5 as my compiler. Sometimes the apps work fine though. Any help would be appreciated.

Morgan[/b]

an unmapped memory exception usually occurs when you are trying to access a peice of memory that has not yet been defined or written too. Check the order in which you define and then access things. You might be trying to read something before it has ever been written too!

Nah, that’s not the problem, I checked that. It is something in loading function from tk, haven’t figured out what though.

Morgan

Actually, that probably is the problem. While it is possible that the tk libs contain bugs, you surely would have noticed when running a lot of the GLUT demos, since many of the examples use the tk libs.

Again, most likely you are calling a tk function with invalid data. A pointer gone astray is 99% of the time the culprit.

ec

It happens when I load a bunch of textures close together (like in consecutive calls), but if the calls are a couple of seconds apart it doesn’t crash (like they are in my custom object loader). I’ve also noticed incompatibilites w/AppleShare starting up if you are trying to load textures. Anybody using MacOS 9? Are any problems fixed?

Morgan

Hrm, I wonder … in what file format are the textures you are trying to load?

I’m running OS 8.6 and haven’t played around much with developing on OS 9 …

ec

Originally posted by Morgan:
[b]When I run some of my Mac OpenGL apps (coded using GLUT) they sometimes crash. This has become more and more of a problem. The problem occurs during the loading of textures using TK to load RGB images. If I am running the debugger when it crashes it says that it was an unmapped memory error. Then when I look through the memory addresses of the GLuints which I am using to store the index to the texture it says “register not available” where it normally says the address. What’s going on here? Note on hardware & software: A 233Mhz iMac (Rev B) w/MacOS 8.6, OpenGL version 1.1.2 & 1.1.3 (I have tried both versions with the same results), and CodeWarrior Pro 5 as my compiler. Sometimes the apps work fine though. Any help would be appreciated.

Morgan[/b]

I’ve been having this same problem, but it does show up in MacOS 8.x as well as 9. And I’m not doing anything particularly strange to load my images… I think it may very well be that there’s a bug in tk.lib, but that some of the aforementioned Tk/GLUT/OpenGL demos that don’t crash don’t load as many textures. BTW, I’m assuming SGI RGB image files.

Originally posted by Lucasi:

I’ve been having this same problem, but it does show up in MacOS 8.x as well as 9. And I’m not doing anything particularly strange to load my images… I think it may very well be that there’s a bug in tk.lib, but that some of the aforementioned Tk/GLUT/OpenGL demos that don’t crash don’t load as many textures. BTW, I’m assuming SGI RGB image files.

As proof (sort of) that it is actually tk.lib, I’ve just replaced the tk image loading in my program with custom image loading and am not crashing at all, whereas before I was crashing about 1/3 of the time.

Same here, loading SGI RGB, and when I replace the tk loader with my own it doesn’t crash (I only use tk because my custom loader doesn’t support RLE compressed RGB, so it sucks for GL demos). This should be reported to Apple, shouldn’t it?

Morgan

Originally posted by Morgan:
Same here, loading SGI RGB, and when I replace the tk loader with my own it doesn’t crash (I only use tk because my custom loader doesn’t support RLE compressed RGB, so it sucks for GL demos). This should be reported to Apple, shouldn’t it?

I really think so… I’ve had the same problems with my own apps… And it only really occurs when I have to load more than one texture. Loading them using my own calls works just fine, but using tkRGBImageLoad() or auxRGBImageLoad() (which, strangely enuf, still crashes, but less… coincidence?) causes unmapped memory errors and if the debugger doesn’t catch it, it brings the entire system down… Boy, can’t wait until OS X, when that won’t happen…


Alexander Powell
alexander@resnet.gatech.edu
Georgia Institute of Technology - AudioLab