Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 96407 - Freecraft SDLCD address space leak
Summary: Freecraft SDLCD address space leak
Status: RESOLVED UPSTREAM
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Games (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Gentoo Games
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-06-17 12:46 UTC by qube99
Modified: 2006-09-03 22:22 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
Makes freecraft use one sdl thread for SDLCD CDRomCheck (freecraft-030311-one_sdl_thread.patch,5.75 KB, patch)
2005-06-17 12:47 UTC, qube99
Details | Diff
Update patch. The address leak is due to not calling SDL_WaitThread. This resolves this while using the new signalling mechanism. (freecraft-030311-one_sdl_thread-v2.patch,5.95 KB, patch)
2005-06-24 20:10 UTC, qube99
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description qube99 2005-06-17 12:46:18 UTC
If Freecraft is compiled with SDLCD support then every second about 2MB of  
virtual address space is allocated; eventually this causes Freecraft to be 
unplayable until it's restarted.  This is because of a bug in 
SDL_CreateThread.  The following patch doesn't fix SDL_CreateThread but  
instead makes Freecraft use a more sane threading approach (make the thread  
once and signal it to do its job instead of recreating the thread once a  
second).  

Reproducible: Always
Steps to Reproduce:
1. Compile Freecraft.  USE flag should include "sdl" (it does by default in  
most profiles)  
2. Run Freecraft.  
3. Look at the Freecraft process in ps or top and notice the VSZ increases. 



Gentoo Base System version 1.4.16 
Portage 2.0.51.19 (default-linux/x86/2005.0, gcc-3.3.5-20050130, 
glibc-2.3.4.20041102-r1, 2.6.11-gentoo-r9 i686) 
================================================================= 
System uname: 2.6.11-gentoo-r9 i686 AMD Athlon(tm) Processor 
Python:              dev-lang/python-2.3.5 [2.3.5 (#1, May 12 2005, 00:28:03)] 
ccache version 2.2 [enabled] 
dev-lang/python:     2.3.5 
sys-apps/sandbox:    [Not Present] 
sys-devel/autoconf:  2.13, 2.59-r6 
sys-devel/automake:  1.9.5, 1.5, 1.7.9-r1, 1.4_p6, 1.6.3, 1.8.5-r3 
sys-devel/binutils:  2.11.92.0.12.3-r2, 2.16-r1 
sys-devel/libtool:   1.5.16 
virtual/os-headers:  2.6.8.1-r2 
ACCEPT_KEYWORDS="x86" 
AUTOCLEAN="yes" 
CFLAGS="-march=athlon-xp -O2 -pipe" 
CHOST="i686-pc-linux-gnu" 
CONFIG_PROTECT="/etc /usr/X11R6/lib/X11/xkb /usr/kde/2/share/config /usr/kde/3.1/share/config /usr/kde/3.3/env /usr/kde/3.3/share/config /usr/kde/3.3/shutdown /usr/kde/3/share/config /usr/lib/X11/xkb /usr/lib/mozilla/defaults/pref /usr/share/config /usr/share/texmf/dvipdfm/config/ /usr/share/texmf/dvips/config/ /usr/share/texmf/tex/generic/config /usr/share/texmf/tex/generic/config/ /usr/share/texmf/tex/platex/config /usr/share/texmf/tex/platex/config/ /usr/share/texmf/xdvi/ /var/qmail/control" 
CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d" 
CXXFLAGS="-march=athlon-xp -O2 -pipe" 
DISTDIR="/usr/portage/distfiles" 
FEATURES="autoaddcvs autoconfig ccache distlocks fixpackages sandbox sfperms 
strict userpriv" 
GENTOO_MIRRORS="ftp://mirrors.tds.net/gentoo http://mirrors.tds.net/gentoo 
ftp://gentoo.netnitco.net/pub/mirrors/gentoo/source/ ftp://gentoo.ccccom.com 
http://gentoo.netnitco.net" 
MAKEOPTS="-j2" 
PKGDIR="/usr/portage/packages" 
PORTAGE_TMPDIR="/mnt/misc/portage/tmp" 
PORTDIR="/usr/portage" 
PORTDIR_OVERLAY="/usr/local/portage" 
SYNC="rsync://rsync.gentoo.org/gentoo-portage" 
USE="x86 3dnow 3dnowex X Xaw3d a52 aac aalib aim alsa apm arts asm avi berkdb 
bitmap-fonts bonobo bzlib cdparanoia cdr crypt cscope curl divx4linux doc dv 
dvd dvdr eds emboss encode esd evo examples exif fam fbcon ffmpeg flac 
foomaticdb fortran gb gcj gd gdbm ggi gif gmp gnome gnustep gpm gstreamer gtk 
gtk2 gtkhtml guile icq imagemagick imlib java jpeg junit kde kdeenablefinal 
kdexdeltas ldap lesstif libg++ libwww live lzo mad mikmod mjpeg mmx mmxext mng 
motif mozcalendar mozilla mozsvg mp3 mpeg mysql mythtv nas ncurses network nls 
objc offensive ogg oggvorbis opengl oscar oss pam pdflib perl pic pie png 
python qt quicktime readline real rtc ruby samba scanner sdl slang softmmu sox 
spell sse ssl svg svga tcltk tcpd tetex theora threads tiff truetype 
truetype-fonts type1-fonts unicode usb v4l v4l2 vcd videos vorbis win32codecs 
wxwindows xine xinerama xml xml2 xmms xv xvid xvmc yahoo zlib userland_GNU 
kernel_linux elibc_glibc" 
Unset:  ASFLAGS, CBUILD, CTARGET, LANG, LC_ALL, LDFLAGS, LINGUAS
Comment 1 qube99 2005-06-17 12:47:25 UTC
Created attachment 61409 [details, diff]
Makes freecraft use one sdl thread for SDLCD CDRomCheck
Comment 2 qube99 2005-06-24 20:10:20 UTC
Created attachment 61886 [details, diff]
Update patch.  The address leak is due to not calling SDL_WaitThread.  This resolves this while using the new signalling mechanism.
Comment 3 SpanKY gentoo-dev 2006-09-03 22:22:21 UTC
no, the saner fix would be to:
 - have a global var 'cdrom_check_thread' and init it to NULL
 - before creating the new thread, if 'cdrom_check_thread' is not NULL, then call SDL_KillThread(cdrom_check_thread)
 - create new thread: cdrom_check_thread = SDL_CreateThread(CDRomCheck, NULL);