[AD] [allegro] linux joystick + dmalloc support + leak report

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


Hi! Two patches this time. Based on CVS one week old or so...

ljoy_2.diff: Adds important version check to the Allegro Linux joystick
driver.This is the same patch as the old one I sent you Eric, except this
one should be endian safe. (The ioctl should return JS_VERSION which has
native endianness AFAIK)

dmalloc.diff: Adds support for the dmalloc malloc debugger suite. I noticed
Allegro recently got support for fortify. All I could find on the internet
was an out of date version 2.2 for DOS which didn't work for me. Also I
found a Debian package which I did not test. In addition I've toyed around
with Valgrind and Electric Fence. both good tools, but slow, memory hogging
or buggy. Valgrind crashes Allegro apps and Electric Fence doesn't report
memory leaks. Dmalloc seems to be perfect though. It is fast when used in
the 'runtime' mode and it reports memory leaks and in what __FILE__ and
__LINE__ the memory were first allocated.

The dmalloc docs suggests -ldmallocth be used on threaded programs
but -ldmalloc works fine for me. At a later time the configure machinery
should check for ALLEGRO_MULTITHREADED and choose the corresponding library
to link with. Also the use of fortify and dmalloc should be made mutually
exclusive. But apply this patch for now as it is tested and works.

By the way... I found four "memory leaks" with dmalloc which turned out to
be bogus. Buffers first allocated as follows: src/readsmp.c:52,
src/readsmp.c:55, src/readbmp.c:51, src/readbmp.c:54. It seems dmalloc
doesn't like memory freed by an exit handler. I don't care much for "Texas"
memory management either. :-) the functions for register_bitmap_file_type()
and register_sample_file_type () should be promoted to the API and
allegro_exit() should just check if they were called (listheads == NULL) to
maintain backwards compatibility.

Sincerely Henrik Stokseth.

Attachment: dmalloc.diff
Description: Binary data

Attachment: ljoy_2.diff
Description: Binary data



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/