[PATCH v2 0/4] xprop: Free various allocated memory

Eirik Byrkjeflot Anonsen eirik at eirikba.org
Thu May 21 05:55:30 PDT 2015


Some time late in 2014 I noticed that one of the processes using the most
memory on my system was called "xprop". I found this a bit surprising, so
I investigated and found that this particular tool generally didn't free
any of the memory it allocated. Which is usually not a problem, since it
just runs and exits. However, the -spy option makes it run forever, and it
seems something on my system is using that to monitor the properties on
the root window.

v2: Set 'prop' to NULL after XFree(prop).

Looks like these patches are made on top of xprop-1.2.1.tar.bz2,
which I now have no idea where I found. I have run valgrind for a
few minutes on the resulting binary:

$ valgrind ./xprop -root -spy
[...]
==25190== 
==25190== HEAP SUMMARY:
==25190==     in use at exit: 147,075 bytes in 107 blocks
==25190==   total heap usage: 11,674 allocs, 11,567 frees, 9,098,145 bytes allocated
==25190== 
==25190== LEAK SUMMARY:
==25190==    definitely lost: 0 bytes in 0 blocks
==25190==    indirectly lost: 0 bytes in 0 blocks
==25190==      possibly lost: 0 bytes in 0 blocks
==25190==    still reachable: 147,075 bytes in 107 blocks
==25190==         suppressed: 0 bytes in 0 blocks
==25190== Rerun with --leak-check=full to see details of leaked memory
==25190== 
==25190== For counts of detected and suppressed errors, rerun with: -v
==25190== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)


Eirik Byrkjeflot Anonsen (4):
  Free the thunks used by Show_Prop
  Free the data returned by XGetWindowProperty()
  Free the data returned by XListProperties()
  Free the data returned by Format_Icons()

 xprop.c | 24 ++++++++++++++++++------
 1 file changed, 18 insertions(+), 6 deletions(-)

-- 
2.1.4



More information about the xorg-devel mailing list