Experimental Physics and Industrial Control System
|
I do not think the 2D video widget use xpm. The original version
did but the current one does not.
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)
- Replies:
- Re: A patch for libXpm.a (was Re: edm : TwoDProfileMonitorClass : cropping/resizing image) Kate Feng
- References:
- Re: edm : TwoDProfileMonitorClass : cropping/resizing image Kate Feng
- A patch for libXpm.a (was Re: edm : TwoDProfileMonitorClass : cropping/resizing image) Kate Feng
- Navigate by Date:
- Prev:
RE: Analog output device support design Mark Rivers
- Next:
Re: A patch for libXpm.a (was Re: edm : TwoDProfileMonitorClass : cropping/resizing image) Kate Feng
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
<2010>
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
- Navigate by Thread:
- Prev:
A patch for libXpm.a (was Re: edm : TwoDProfileMonitorClass : cropping/resizing image) Kate Feng
- Next:
Re: A patch for libXpm.a (was Re: edm : TwoDProfileMonitorClass : cropping/resizing image) Kate Feng
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
<2010>
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
|
ANJ, 02 Sep 2010 |
·
Home
·
News
·
About
·
Base
·
Modules
·
Extensions
·
Distributions
·
Download
·
·
Search
·
EPICS V4
·
IRMIS
·
Talk
·
Bugs
·
Documents
·
Links
·
Licensing
·
|