Hello,

  Yeah Valgrind is definitly a great set of tools... I fix the autoFree bug in 
the class Surface, it was just never initialized in some constructor.

  I wrote the Surface class so using SDL_Surface* is easier and so there is 
less memory leaks. I think there is still some even in this Surface class, if 
someone could review the code to check, it would be great.

  With valgrind I still get a :
==20040== 5053364 bytes in 128 blocks are possibly lost in loss record 180 of 
181
==20040==    at 0x1B9008A2: malloc (vg_replace_malloc.c:149)
==20040==    by 0x4D1E97E4: SDL_CreateRGBSurface 
(in /usr/lib/libSDL-1.2.so.0.7.1)
==20040==    by 0x4D038692: rotozoomSurfaceXY (SDL_rotozoom.c:702)
==20040==    by 0x80638E6: Wormux::Surface::RotoZoomXY(double, double, double, 
int) (surface.cpp:214)
==20040==    by 0x80662D1: Sprite::EnableRotationCache(unsigned) 
(sprite.cpp:195)
==20040==    by 0x80D1E51: Wormux::RoquetteBazooka::Init() (bazooka.cpp:65)
==20040==    by 0x80D27BD: Wormux::Bazooka::p_Init() (bazooka.cpp:155)
==20040==    by 0x80C8DFF: Weapon::Init() (weapon.cpp:220)
==20040==    by 0x80CA88F: WeaponsList::InitAndAddToList(Weapon*, unsigned) 
(weapons_list.cpp:59)
==20040==    by 0x80CA9ED: WeaponsList::Init() (weapons_list.cpp:76)
==20040==    by 0x80553DE: Wormux::Config::Applique() (config.cpp:230)
==20040==    by 0x8054A06: AppWormux::Init(int, char**) (main.cpp:121)

Olivier

Le Lundi 30 Janvier 2006 22:03, Kurosu a écrit :
> Hello,
>
> I've decided to get a look at the memory handling in worms, and check
> typical initialization problems, using valgrind [1] 3.1.0 (Debian) tool
> named memcheck [2], which I find very effective, at least it is 100%
> when I code. So far, I just loaded the game, let it display the menu
> then exit.
>
> Well, it seems there are lots of leaks and uninitialized data access,
> mainly due to autoFree not set most of the time in Surface objects,
> which I find rather strange though. This ends up with those typical
> results:
>

...

>
> Best regards,
> Kurosu



Répondre à