SDL_DisplayFormat dependant on system memory?

I’ve been having some trouble with calls to SDL_DisplayFormat
generating crashes on some of the systems I’ve been testing on. The
crash seems to depend on the main SDL display size when
SDL_DisplayFormat is called; smaller sizes don’t crash where larger
ones do. I have a very low end system (8 meg RAM) that has programs
crash that run fine on my more modern systems (512 or 1024 megs RAM),
but runs them fine if calls to SDL_DisplayFormat are removed.

My understanding is that SDL_DisplayFormat can be a very important
tool in optomizing blit speed for applications in SDL. However, it
seems to me that the call to SDL_DisplayFormat fails in relation to
system memory somehow, which seems very strange to me. Does anybody on
the list have any insight into the mechanics of SDL_DisplayFormat (or
SDL_ConvertSurface) that would clear this up for me?__________________________________
Do you Yahoo!?
Yahoo! Domains ? Claim yours for only $14.70/year
http://smallbusiness.promotions.yahoo.com/offer

NBarnes wrote:

I’ve been having some trouble with calls to SDL_DisplayFormat
generating crashes on some of the systems I’ve been testing on. The
crash seems to depend on the main SDL display size when
SDL_DisplayFormat is called; smaller sizes don’t crash where larger
ones do. I have a very low end system (8 meg RAM) that has programs
crash that run fine on my more modern systems (512 or 1024 megs RAM),
but runs them fine if calls to SDL_DisplayFormat are removed.

My understanding is that SDL_DisplayFormat can be a very important
tool in optomizing blit speed for applications in SDL. However, it
seems to me that the call to SDL_DisplayFormat fails in relation to
system memory somehow, which seems very strange to me. Does anybody on
the list have any insight into the mechanics of SDL_DisplayFormat (or
SDL_ConvertSurface) that would clear this up for me?

So, did you check your program with a memory checker since last time you
asked this ?
Or do you have a source code reproducing the problem ?

Stephane

I’m rather new, but how about this:
Maybe the new format takes up more space so it reads/writes into system ram,
causing the computer to crash?

Cjmovie wrote:

I’m rather new, but how about this:
Maybe the new format takes up more space so it reads/writes into system ram,
causing the computer to crash?

Well, unless there’s a bug somewhere, SDL_DisplayFormat returns NULL if
the memory allocation fails.

Stephane

Cjmovie wrote:

I’m rather new, but how about this:
Maybe the new format takes up more space so it reads/writes into system ram,
causing the computer to crash?

Hmm, sorry for my previous post I didn’t read you suggestion correctly.

The new format will come with a new surface of sufficient size to
read/write to it. But surely there’s a problem with memory access
somewhere, and that’s where I’d like to see some source code to
reproduce this and/or a memory debugger in action.

Stephnae

Stephane Marchesin wrote:

So, did you check your program with a memory checker since last time
you asked this ? Or do you have a source code reproducing the problem
?

Debugger fails in the SDL_DisplayFormat call, which does NOT get as
far as returning NULL. I’ll work my source code into a trivial
implementation demonstrating the problem later tonight and send it to
the list.

Cjmovie wrote:

I’m rather new, but how about this:
Maybe the new format takes up more space so it reads/writes into
system ram, causing the computer to crash?

I believe that Stephane is correct, SDL_DisplayFormat theoretically
fails gracefully and returns NULL if the memory allocations involved
fail. My own use of SDL_DisplayFormat is internal to a class designed
to wrap SDL_Surface and SDL_LoadBMP, and the subroutine that loads
bitmaps goes on to call SDL_DisplayFormat, doing NULL-checking on
the surfaces where appropriate along the way. As I’ve said, stepping
through the code with the debugger, in the cases where the
SDL_DisplayFormat call fails, it fails internally, without ever
returning.

                                                         NBarnes__________________________________

Do you Yahoo!?
Yahoo! Domains ? Claim yours for only $14.70/year
http://smallbusiness.promotions.yahoo.com/offer

I’ve been having some trouble with calls to SDL_DisplayFormat
generating crashes on some of the systems I’ve been testing on. The
crash seems to depend on the main SDL display size when
SDL_DisplayFormat is called; smaller sizes don’t crash where larger
ones do. I have a very low end system (8 meg RAM) that has programs
crash that run fine on my more modern systems (512 or 1024 megs RAM),
but runs them fine if calls to SDL_DisplayFormat are removed.

Make sure that you free the old surfaces after you get new ones with
SDL_DisplayFormat(). Otherwise the old surfaces will stay around and
you might run out of memory.

See ya,
-Sam Lantinga, Software Engineer, Blizzard Entertainment