Memoryhole, again

Hi,

on my system Debian 2.0, kernel 2.2.4 I?m able to reproduce the memory
leak as follows:

  • start top -d1 (I lack a decent mem-debugger … what do you use ?)
  • start the following program testalloc:

watch the memsize of the program growing …
(I suppose it should not do so.)

//testalloc

#include <stdio.h>
#include <stdlib.h>

#include “SDL.h”

int main(int argc, char *argv[])
{

SDL_Surface* tmp;
SDL_Surface* tmp2;

int i=0;

if ( SDL_Init(SDL_INIT_VIDEO) < 0 ) {
fprintf(stderr, “Couldn’t initialize SDL: %s\n”,SDL_GetError());
exit(1);
}

SDL_SetVideoMode(320, 200, 16, 0);

i=0;
while(i < 20000)
{
tmp = SDL_AllocSurface( SDL_SWSURFACE,100,100,
32,
0x000000FF, 0x0000FF00,
0x00FF0000, 0xFF000000);

  tmp2 = SDL_DisplayFormat(tmp);       
  
  SDL_FreeSurface(tmp);      
  SDL_FreeSurface(tmp2);       
  i++;    
}    

}–
Karsten-O. Laux
klaux at student.uni-kl.de
http://www.rhrk.uni-kl.de/~klaux
UIN 21614933 (Bert)

Karsten Laux wrote:

Hi,

on my system Debian 2.0, kernel 2.2.4 I?m able to reproduce the memory
leak as follows:

  • start top -d1 (I lack a decent mem-debugger … what do you use ?)
  • start the following program testalloc:

watch the memsize of the program growing …
(I suppose it should not do so.)

//testalloc

SNIPPED

Sorry for all this fuss… I have used old SDL 0.9.9. (stupid boy I am)

I have just installed SDL 0.9.13 and all is fine now !
No memory vanishes anymore. :slight_smile:

However two questions on 0.9.13:

SDL?s netlib complains about SDL_SwapBE16() not being available.

Has SDL_CalculateEndian() become obsolute ?–
Karsten-O. Laux
klaux at student.uni-kl.de
http://www.rhrk.uni-kl.de/~klaux
UIN 21614933 (Bert)

However two questions on 0.9.13:

SDL?s netlib complains about SDL_SwapBE16() not being available.

Has SDL_CalculateEndian() become obsolute ?

Yes. You should instead use the SDL_BYTEORDER macro, and compare it
to SDL_BIG_ENDIAN and SDL_LIL_ENDIAN.

netlib shouldn’t complain. I’ll fix it. :slight_smile:

-Sam Lantinga				(slouken at devolution.com)

Lead Programmer, Loki Entertainment Software–
Author of Simple DirectMedia Layer -
http://www.devolution.com/~slouken/SDL/