[SDL] ot - memory leaks
Patricia Curtis
patricia.curtis at gmail.com
Thu Aug 2 10:18:19 PDT 2007
Hi neil
as far as memory leaks are concerned, on windows i often open
the task manager and watch the memory usage of the task (game), it
would normally fluctuate but will not steadily increase, if its
increasing without any user interaction, the would narrow it down the
the loop that's running, obviously the converse narrows it down to the
user functions.
Are you making surfaces like using SDL_TTF or rotozoom? i found they
would eat memory if i did not free the surfaces, also are you making
local variable surfaces in a loop that could be eating away.
To track it,
10 comment one part out and test for the leak.
20 no change THEN un-comment go to 10
30 Fix bug
Trish
On 8/2/07, sdl-request at lists.libsdl.org <sdl-request at lists.libsdl.org> wrote:
> Send SDL mailing list submissions to
> sdl at lists.libsdl.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
> http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
> or, via email, send a message with subject or body 'help' to
> sdl-request at lists.libsdl.org
>
> You can reach the person managing the list at
> sdl-owner at lists.libsdl.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of SDL digest..."
>
>
> Today's Topics:
>
> 1. Re: SDL 1.3 - SDL_Texture or SDL_Surface? (David Olofson)
> 2. Cannot compile SDL_ttf under Cygwin (L-28C)
> 3. Re: SDL 1.3 - SDL_Texture or SDL_Surface? (Torsten Giebl)
> 4. Re: SDL 1.3 - SDL_Texture or SDL_Surface? (Torsten Giebl)
> 5. Re: SDL 1.3 - SDL_Texture or SDL_Surface? (Jacek Poplawski)
> 6. ot - memory leaks (neil at cloudsprinter.com)
> 7. Re: ot - memory leaks (Jacek Poplawski)
> 8. Re: ot - memory leaks (Skunk Guru)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Thu, 2 Aug 2007 12:27:26 +0200
> From: David Olofson <david at olofson.net>
> Subject: Re: [SDL] SDL 1.3 - SDL_Texture or SDL_Surface?
> To: "A list for developers using the SDL library. (includes
> SDL-announce)" <sdl at lists.libsdl.org>
> Message-ID: <200708021227.26881.david at olofson.net>
> Content-Type: text/plain; charset="iso-8859-1"
>
> On Thursday 02 August 2007, Sitsofe Wheeler wrote:
> [...]
> > With Vista my understanding was that the minimum out of the box
> > experience for OpenGL had been raised at the cost of the maximum
> > performance/capability without specialist drivers (due to OpenGL on
> > Direct3D emulation). Can anyone confirm that this in indeed the
> > case?
>
> There were some last minute changes there (the original plan wasn't
> too popular), but I don't remember the details. You should be able to
> find the full story on the 'net.
>
>
> > If so in a decade's time things may be simultaneously worse and
> > better for OpenGL but it's true 99% of the people I know doing 3D on
> > Windows do it using Direct3D and not OpenGL.
>
> Well, Microsoft will probably try to keep it this way. Windows
> (including XBox) is a gaming platform large enough that many consider
> it the only platform worth supporting. As long as MS can keep it
> expensive to port to other platforms, Windows will remain the
> platform of choice for gamers. Other platforms won't have a chance to
> gain enough momentum to become the primary target of a significant
> number of developers.
>
>
> > Is OpenGL really only become the 3D API for the 5% of non-Windows
> > platforms?
>
> I don't believe it's *that* bad. Although the really big market is
> causual games (where most of the indie game developers hang around),
> AAA titles are big business - and AAA titles are mostly played by
> hardcore gamers and other relatively advanced users. Many of these
> games are OpenGL only, and that doesn't seem to be all that much of
> an issue.
>
>
> //David Olofson - Programmer, Composer, Open Source Advocate
>
> .------- http://olofson.net - Games, SDL examples -------.
> | http://zeespace.net - 2.5D rendering engine |
> | http://audiality.org - Music/audio engine |
> | http://eel.olofson.net - Real time scripting |
> '-- http://www.reologica.se - Rheology instrumentation --'
>
>
> ------------------------------
>
> Message: 2
> Date: Thu, 02 Aug 2007 09:43:19 -0400
> From: L-28C <kixdemp at gmail.com>
> Subject: [SDL] Cannot compile SDL_ttf under Cygwin
> To: sdl at libsdl.org
> Message-ID: <f8sn1s$fa2$1 at sea.gmane.org>
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>
> Hello everyone!
>
> Okay, I did a google search. To prove so... :-)
> http://twomix.devolution.com/pipermail/sdl/2003-July/055083.html
> http://www.wesnoth.org/forum/viewtopic.php?p=196813&sid=bcf0872127cb71f20774d8a2c903a548
>
> I'm having the same problem as the first link. The linker cannot find
> "_setjmp". He got no replies... The second link suggests to compile
> everything yourself, which I did.
>
> Maybe I should use an older version of FreeType or something?
>
> Thanks in advance!
>
> P.S, here's my linker output:
>
> Leo at Rita /cygdrive/c/ttf/sdl_ttf-2.0.9
> $ make
> if /bin/sh ./libtool --tag=CC --mode=compile gcc -DPACKAGE_NAME=\"\"
> -DPACKAGE_T
> ARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\"
> -DPACKAGE_BUGREPORT=\"\
> " -DPACKAGE=\"SDL_ttf\" -DVERSION=\"2.0.9\" -DSTDC_HEADERS=1
> -DHAVE_SYS_TYPES_H=
> 1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1
> -DHAVE_MEMORY_H=1 -DHA
> VE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1
> -DHAVE_DL
> FCN_H=1 -I. -I. -g -O2 -I/usr/local/include/freetype2
> -I/usr/local/include
> -I/usr/local/include/SDL -I/usr/include/mingw -mno-cygwin
> -Dmain=SDL_main -DHAVE
> _OPENGL -MT SDL_ttf.lo -MD -MP -MF ".deps/SDL_ttf.Tpo" -c -o SDL_ttf.lo
> SDL_ttf.
> c; \
> then mv -f ".deps/SDL_ttf.Tpo" ".deps/SDL_ttf.Plo"; else rm -f
> ".deps/SD
> L_ttf.Tpo"; exit 1; fi
> mkdir .libs
> gcc -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\"
> -DPACKAGE
> _STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE=\"SDL_ttf\"
> -DVERSION=\"2.0.9\"
> -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1
> -DHAVE_STDLIB_H=1 -DHA
> VE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1
> -DHAVE_ST
> DINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -I. -I. -g -O2
> -I/usr/local/include/
> freetype2 -I/usr/local/include -I/usr/local/include/SDL
> -I/usr/include/mingw -mn
> o-cygwin -Dmain=SDL_main -DHAVE_OPENGL -MT SDL_ttf.lo -MD -MP -MF
> .deps/SDL_ttf.
> Tpo -c SDL_ttf.c -DPIC -o .libs/SDL_ttf.o
> gcc -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\"
> -DPACKAGE
> _STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE=\"SDL_ttf\"
> -DVERSION=\"2.0.9\"
> -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1
> -DHAVE_STDLIB_H=1 -DHA
> VE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1
> -DHAVE_ST
> DINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -I. -I. -g -O2
> -I/usr/local/include/
> freetype2 -I/usr/local/include -I/usr/local/include/SDL
> -I/usr/include/mingw -mn
> o-cygwin -Dmain=SDL_main -DHAVE_OPENGL -MT SDL_ttf.lo -MD -MP -MF
> .deps/SDL_ttf.
> Tpo -c SDL_ttf.c -o SDL_ttf.o >/dev/null 2>&1
> windres version.rc version.o
> /bin/sh ./libtool --tag=CC --mode=link gcc -g -O2
> -I/usr/local/include/freetype
> 2 -I/usr/local/include -I/usr/local/include/SDL -I/usr/include/mingw
> -mno-cygwin
> -Dmain=SDL_main -DHAVE_OPENGL -o libSDL_ttf.la -rpath /usr/local/lib
> -no-unde
> fined -release 2.0 -version-info 6:3:6 -Wl,version.o SDL_ttf.lo
> -L/usr/local/li
> b -L/usr/local/lib -lfreetype -lz -L/usr/local/lib -lmingw32 -lSDLmain
> -lSDL -mn
> o-cygwin -mwindows
> gcc -shared .libs/SDL_ttf.o -L/usr/local/lib
> /usr/local/lib/libfreetype.a -lz
> -lmingw32 -lSDLmain /usr/local/lib/libSDL.dll.a -mno-cygwin
> -Wl,version.o -mno-
> cygwin -mwindows -o .libs/SDL_ttf.dll -Wl,--enable-auto-image-base
> -Xlinker --ou
> t-implib -Xlinker .libs/libSDL_ttf.dll.a
> /usr/local/lib/libfreetype.a(sfnt.o): In function `tt_face_build_cmaps':
> /cygdrive/c/ft/freetype-2.3.5/src/sfnt/ttcmap.c:2309: undefined
> reference to `_s
> etjmp'
> /usr/local/lib/libfreetype.a(smooth.o): In function
> `gray_convert_glyph_inner':
> /cygdrive/c/ft/freetype-2.3.5/src/smooth/ftgrays.c:1619: undefined
> reference to
> `_setjmp'
> Creating library file: .libs/libSDL_ttf.dll.a
> collect2: ld returned 1 exit status
> make: *** [libSDL_ttf.la] Error 1
>
>
>
> ------------------------------
>
> Message: 3
> Date: Thu, 2 Aug 2007 15:53:20 +0200 (CEST)
> From: "Torsten Giebl" <wizard at syntheticsw.com>
> Subject: Re: [SDL] SDL 1.3 - SDL_Texture or SDL_Surface?
> To: "A list for developers using the SDL library. (includes
> SDL-announce)" <sdl at lists.libsdl.org>
> Message-ID:
> <1486.141.99.122.11.1186062800.squirrel at mail.syntheticsw.com>
> Content-Type: text/plain;charset=iso-8859-1
>
> Hello !
>
>
> Sorry i really don't understand where the problem here is.
>
> You cannot go with 2D and OpenGL alone. On one side
> thanks to Microsoft trying to kill all standards, that they don't
> created. On the other side for bad drivers from companies, that
> only support D3D.
>
> This is a fact i think and everybody here will aggree.
>
> So SDL 1.3 needs a D3D driver that is regularly
> updated, an OpenGL and 2D drivers like GDI, X11, ...
>
> SDL 1.3 will need to support at least all the things
> that SDL 1.2 supported. So old apps can be as easy
> as possible ported to it. But adding a lot more
> like rotating, zooming would be nice, but it will
> bloat SDL.
>
> Look at ALLEGRO, it is good/bad example for trying to put
> everything into an API.
>
>
> David Olofson named something like Advanced2D that
> could be easily created as an AddOn Library for a good designed
> SDL 1.3. It would need to support a D3D part, an OpenGL and a 2D
> part as a fallback.
>
> SDL 1.3 should have basically the same commands
> like SDL 1.2 +
>
> SDL_CreateTexture (SDL_Surface)
> SDL_RemoveTexture (SDL_Surface)
> SDL_UpdateTexture (SDL_Surface)
>
> SDL_BlitSurface will work the same as before,
> it only looks maybe on a SDL_Surface flag, that
> when there is a texture assoc. with that Surface,
> use this for fast blitting.
>
> With the 2D drivers this will be a dummy,
> as there is no texture support.
> OpenGL and D3D will use their Textures to allow
> fast screen blitting.
>
> And once you have Texture support, with an external
> library you can do anything with these Textures
> you want, use them for rotating blitting, use them for
> complicated shader blits or whatever.
>
> What is the current situation in SDL1.3.
> I thought there were methods to allow to associate
> a Texture to a SDL_Surface.
>
>
> CU
>
>
>
> ------------------------------
>
> Message: 4
> Date: Thu, 02 Aug 2007 16:15:51 +0200
> From: Torsten Giebl <wizard at syntheticsw.com>
> Subject: Re: [SDL] SDL 1.3 - SDL_Texture or SDL_Surface?
> To: "A list for developers using the SDL library. (includes
> SDL-announce)" <sdl at lists.libsdl.org>
> Message-ID: <46B1E717.8000005 at syntheticsw.com>
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>
> Hello !
>
>
> Is there a way to extract, maybe from the header files,
> the current SDL 1.3 API without Audio, ... only the GFX API
> and only the commands that are public to the user
> at the end ?
>
> This would allow a more practical discussion.
> What parameters are needed, what way SDL 1.3 is
> already different to SDL 1.2.
>
>
> CU
>
>
> ------------------------------
>
> Message: 5
> Date: Thu, 2 Aug 2007 16:33:07 +0200
> From: "Jacek Poplawski" <jacekpoplawski at gmail.com>
> Subject: Re: [SDL] SDL 1.3 - SDL_Texture or SDL_Surface?
> To: "A list for developers using the SDL library. (includes
> SDL-announce)" <sdl at lists.libsdl.org>
> Message-ID:
> <1f276abf0708020733i3bf75967y28c311766e1b831e at mail.gmail.com>
> Content-Type: text/plain; charset="iso-8859-1"
>
> On 8/2/07, Torsten Giebl <wizard at syntheticsw.com> wrote:
> >
> > But adding a lot more
> > like rotating, zooming would be nice, but it will
> > bloat SDL.
>
>
> True.
>
> There is no good support for image formats (SDL_Image can only load, not
> save, and doesn't allow to control quality), so why support image
> transformations inside SDL?
>
> --
> Free Software - find interesting programs and change them
> NetHack - meet interesting creatures, kill them and eat their bodies
> Usenet - meet interesting people from all over the world and flame them
> Decopter - unrealistic helicopter simulator, get it from
> http://decopter.sf.net
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: http://lists.libsdl.org/private.cgi/sdl-libsdl.org/attachments/20070802/2b61cd60/attachment-0001.htm
>
> ------------------------------
>
> Message: 6
> Date: Thu, 2 Aug 2007 16:00:42 +0100
> From: neil at cloudsprinter.com
> Subject: [SDL] ot - memory leaks
> To: sdl at lists.libsdl.org
> Message-ID:
> <20070802160042.6324ktcpkck4skgs at webmail.cloudsprinter.com>
> Content-Type: text/plain; charset=ISO-8859-1
>
> sorry for being off topic again, this is the only progrming list is subscribe to
>
> i'm not exactly a proffesionally trained c programmer, but my code is getting
> pretty tight.
>
> the only thing letting it down now is memory leaks, ive been poking around a bit
> on google, but all articles i can find on the subject are a bit vauge.. if
> someone can point me to a good resource about what will cause a memory leak and
> what needs doing where and when to prevent them i would appreciate it.
>
>
>
> ------------------------------
>
> Message: 7
> Date: Thu, 2 Aug 2007 17:12:51 +0200
> From: "Jacek Poplawski" <jacekpoplawski at gmail.com>
> Subject: Re: [SDL] ot - memory leaks
> To: "A list for developers using the SDL library. (includes
> SDL-announce)" <sdl at lists.libsdl.org>
> Message-ID:
> <1f276abf0708020812jb55182apb91ef946a9d91b06 at mail.gmail.com>
> Content-Type: text/plain; charset="iso-8859-1"
>
> On 8/2/07, neil at cloudsprinter.com <neil at cloudsprinter.com> wrote:
> >
> > the only thing letting it down now is memory leaks, ive been poking around
> > a bit
> > on google, but all articles i can find on the subject are a bit vauge.. if
> > someone can point me to a good resource about what will cause a memory
> > leak and
> > what needs doing where and when to prevent them i would appreciate it.
>
>
> Run valgrind on your application (http://valgrind.org/).
> However, I always (even on almost empty application) have some SDL-related
> valgrind errors.
> Like the one when setting video mode.
>
>
> --
> Free Software - find interesting programs and change them
> NetHack - meet interesting creatures, kill them and eat their bodies
> Usenet - meet interesting people from all over the world and flame them
> Decopter - unrealistic helicopter simulator, get it from
> http://decopter.sf.net
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: http://lists.libsdl.org/private.cgi/sdl-libsdl.org/attachments/20070802/26b16608/attachment.html
>
> ------------------------------
>
> Message: 8
> Date: Thu, 2 Aug 2007 17:21:54 +0200
> From: "Skunk Guru" <skunkguru at gmail.com>
> Subject: Re: [SDL] ot - memory leaks
> To: "A list for developers using the SDL library. (includes
> SDL-announce)" <sdl at lists.libsdl.org>
> Message-ID:
> <fa7ebe7c0708020821v1691b2daxbec68e003663f6aa at mail.gmail.com>
> Content-Type: text/plain; charset="iso-8859-1"
>
> 2007/8/2, Jacek Poplawski <jacekpoplawski at gmail.com>:
> >
> > On 8/2/07, neil at cloudsprinter.com <neil at cloudsprinter.com> wrote:
> > >
> > > the only thing letting it down now is memory leaks, ive been poking
> > > around a bit
> > > on google, but all articles i can find on the subject are a bit vauge..
> > > if
> > > someone can point me to a good resource about what will cause a memory
> > > leak and
> > > what needs doing where and when to prevent them i would appreciate it.
> >
> >
> > Run valgrind on your application ( http://valgrind.org/).
> > However, I always (even on almost empty application) have some SDL-related
> > valgrind errors.
> > Like the one when setting video mode.
> >
>
>
> what about Windows programmers ?
>
> --
> SkunkGuru.
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: http://lists.libsdl.org/private.cgi/sdl-libsdl.org/attachments/20070802/430df1ce/attachment.htm
>
> ------------------------------
>
> _______________________________________________
> SDL mailing list
> SDL at lists.libsdl.org
> http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
>
>
> End of SDL Digest, Vol 8, Issue 5
> *********************************
>
--
In a time of universal deceit, telling the truth is a revolutionary act.
Trish & Thy also Available on
Skype tranmaithy63,
More information about the SDL
mailing list