EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  <20102011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  <20102011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: A patch for libXpm.a (was Re: edm : TwoDProfileMonitorClass : cropping/resizing image)
From: Kate Feng <[email protected]>
To: John William Sinclair <[email protected]>
Cc: "[email protected]" <[email protected]>
Date: Tue, 27 Jul 2010 16:08:06 -0400
John William Sinclair wrote:
I do not think the 2D video widget use xpm. The original version
did but the current one does not.
I found out that 'after' I had the code for libXpm.a fixed.  :-)
I will update to the current one.  I  should have sent the patch to
xorg instead.

Regards,
Kate

John Sinclair


Kate Feng wrote:
Hi all,

  I do not know if anyone still use the libXpm.a library
for X11 applications. Since it is used in the 2D video
widget that I mentioned in the previous thread, I attach
the patch here, which fixes the memory leak that happened
on both our Linux RedHat and Debian PCs.  The memory leak
can be detected if the video display is exposed for
some period of time (e.g. not iconized).

I downloaded the source code (ie. xpm-3.4k.tar.gz) for
libXpm.a at ftp://ftp.x.org/contrib/libraries
and applied the attached patch.  If XpmReturnAllocPixels
is not specified in the attributes->valuemask, then
(*freeColors)() should be called.  I hope this helps.

Cheers,
Kate


diff -u create.c.orig create.c
--- create.c.orig 1998-03-19 14:51:00.000000000 -0500
+++ create.c 2010-05-20 09:42:41.000000000 -0400
@@ -929,8 +929,11 @@
if (attributes && (attributes->valuemask & XpmReturnAllocPixels)) {
attributes->alloc_pixels = alloc_pixels;
attributes->nalloc_pixels = nalloc_pixels;
- } else
- XpmFree(alloc_pixels);
+ } else {
+ /* Kate Feng: feeColors() if alloc'ed pixels is not return. Otherwise, memory leaks */
+ (*freeColors)(display, colormap, alloc_pixels, nalloc_pixels, NULL);
+ XpmFree(alloc_pixels);
+ }


/* return created images */
if (image_return)
@@ -2234,8 +2237,11 @@
if (attributes && (attributes->valuemask & XpmReturnAllocPixels)) {
attributes->alloc_pixels = alloc_pixels;
attributes->nalloc_pixels = nalloc_pixels;
- } else
- XpmFree(alloc_pixels);
+ } else {
+ /* Kate Feng: feeColors() if alloc'ed pixels is not return. Otherwise, memory leaks */
+ (*freeColors)(display, colormap, alloc_pixels, nalloc_pixels, NULL);
+ XpmFree(alloc_pixels);
+ }


     /* return created images */
     if (image_return)




References:
Re: edm : TwoDProfileMonitorClass : cropping/resizing image Kate Feng
A patch for libXpm.a (was Re: edm : TwoDProfileMonitorClass : cropping/resizing image) Kate Feng
Re: A patch for libXpm.a (was Re: edm : TwoDProfileMonitorClass : cropping/resizing image) John William Sinclair

Navigate by Date:
Prev: Re: A patch for libXpm.a (was Re: edm : TwoDProfileMonitorClass : cropping/resizing image) John William Sinclair
Next: Tech-talk archives excluded from indexing? Angus Gratton
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  <20102011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Re: A patch for libXpm.a (was Re: edm : TwoDProfileMonitorClass : cropping/resizing image) John William Sinclair
Next: Image processing plugin for areaDetector James.OHea
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  <20102011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 02 Sep 2010 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·