[comp.windows.x] server patch for xphoon running under X10.4 on a Sun

leres@ace.ee.lbl.gov (Craig Leres) (08/25/88)

Several people have noticed that when they run the X10.4 xphoon on a
Sun using the -t or -d options, the server eats large chunks of memory.
Appended is a context diff to libsun/bitpix.c which fixes a memory
leak. The basic problem is that the bitmap associated with a pixmap is
lost when a pixmap is freed. (Note that this is true for all pixmaps;
the only reason this bug is more noticable with xphoon is because its
bitmaps are so large.

I've also included a patch to X/main.c which increases MAXBUFSIZE so
that you can load really big bitmaps (for example, screen sized Sun
hi-res bitmaps...) I don't think this patch is necessary for xbigphoon
since it uses the bigcheapmoon, not the bigfullmoon bitmap.

		Craig

RCS file: RCS/bitpix.c,v
retrieving revision 1.1
diff -c -r1.1 bitpix.c
*** /tmp/,RCSt1a01315	Wed Aug 24 13:23:21 1988
--- bitpix.c	Tue Jun  7 20:14:08 1988
***************
*** 1,5 ****
  #ifndef lint
! static char *rcsid_bitpix_c = "$Header: bitpix.c,v 1.1 88/06/07 20:05:09 leres Exp $";
  #endif	lint
  #ifdef	sun
  /*
--- 1,5 ----
  #ifndef lint
! static char *rcsid_bitpix_c = "$Header: bitpix.c,v 1.2 88/06/07 20:13:30 leres Exp $";
  #endif	lint
  #ifdef	sun
  /*
***************
*** 186,192 ****
  FreePixmap (pixmap)
  	register PIXMAP *pixmap;
  {
!     switch (pixmap->kind) {
      case BitmapPixmap:
  	{
  	    register BITMAP *bm;
--- 186,192 ----
  FreePixmap (pixmap)
  	register PIXMAP *pixmap;
  {
!     switch (PTYPE(pixmap)) {
      case BitmapPixmap:
  	{
  	    register BITMAP *bm;
***************
*** 359,365 ****
      PIXMAP     *pm;
      BITMAP     *bm;
      pm = PixmapSave(srcx, srcy, width, height);
!     switch (pm->kind) {
      case BitmapPixmap:{
  	    int         size = BitmapSize(width, height);
  
--- 359,365 ----
      PIXMAP     *pm;
      BITMAP     *bm;
      pm = PixmapSave(srcx, srcy, width, height);
!     switch (PTYPE(pm)) {
      case BitmapPixmap:{
  	    int         size = BitmapSize(width, height);
  

RCS file: RCS/main.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -c -r1.2 -r1.3
*** /tmp/,RCSt1a01289	Wed Aug 24 13:21:22 1988
--- /tmp/,RCSt2a01289	Wed Aug 24 13:21:23 1988
***************
*** 5,11 ****
  /* Initialization and socket routines */
  
  #ifndef lint
! static char *rcsid_main_c = "$Header: main.c,v 1.2 87/10/10 21:09:45 leres Exp $";
  #endif
  
  #include <dbm.h>
--- 5,11 ----
  /* Initialization and socket routines */
  
  #ifndef lint
! static char *rcsid_main_c = "$Header: main.c,v 1.3 88/05/29 15:36:44 leres Exp $";
  #endif
  
  #include <dbm.h>
***************
*** 105,111 ****
  int bufcnt[maxsocks];		/* Buffer counts */
  				/* Count of data bytes available in sockbuf */
  #define DEFBUFSIZE 4096		/* Default buffer size */
! #define MAXBUFSIZE (1<<17)	/* Maximum buffer size */
  static int bufsize[maxsocks];	/* Buffer sizes */
  				/* Current size in bytes of sockbuf buffer */
  #ifdef DUALTCP
--- 105,111 ----
  int bufcnt[maxsocks];		/* Buffer counts */
  				/* Count of data bytes available in sockbuf */
  #define DEFBUFSIZE 4096		/* Default buffer size */
! #define MAXBUFSIZE (1<<18)	/* Maximum buffer size */
  static int bufsize[maxsocks];	/* Buffer sizes */
  				/* Current size in bytes of sockbuf buffer */
  #ifdef DUALTCP