[PATCH:xscope 00/14] Reduce memory usage, clean up alloc interfaces

Alan Coopersmith alan.coopersmith at ORACLE.COM
Sat Sep 24 08:48:18 PDT 2011

Finally returning to the xscope work from many months ago, previously
submitted as one large patch: http://patchwork.freedesktop.org/patch/4262/

This reworked the code to get rid of the compiled in StaticMaxFD altogether,
plus adds in a bunch of other cleanup such as malloc function standardization.

With all that, it's been split up into more managable chunks for review, 
also available for review or pulling online at:

Running xscope with a single xclock client being traced:
    with the original version, StaticMaxFD=256:	   11576 Kb memory used
    with this version:	   		    	    3552 Kb memory used

Alan Coopersmith (14):
  Clean up existing malloc calls
  Stop wrapping malloc & free
  Call realloc() instead of open coding it
  Use calloc() instead of malloc(); bzero();
  Use strdup instead of malloc(strlen+1); strcpy();
  Ensure ScopeHost global is initialized when built with USE_XTRANS
  Make CS dynamically allocated
  Make ReplyQ dynamically allocated
  Allocate buffers dynamically as needed instead of as part of fdinfo
  Make FDinfo dynamically allocated
  Remove StaticMaxFD now that all uses now allocate dynamically
  File descriptors should be stored in ints not shorts
  Store ClientNumber as int instead of converting back & forth to long
  Add const attributes to clear gcc -Wwrite-strings warnings

 audio.c        |    4 ++--
 common.c       |   50 +++++++++++++-------------------------------------
 decode11.c     |   17 ++++++++---------
 extensions.c   |   14 ++++++++++----
 fd.c           |   17 +++++++----------
 fd.h           |    9 +++------
 print_render.c |    4 ++--
 proto.h        |   10 ++++------
 prtype.c       |    2 +-
 scope.c        |   40 ++++++++++++++++++++++++++++------------
 scope.h        |    6 +++---
 server.c       |   14 ++++++--------
 table11.c      |   15 ++++++++++-----
 x11.h          |    2 +-
 14 files changed, 98 insertions(+), 106 deletions(-)


More information about the xorg-devel mailing list