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

Eirik Byrkjeflot Anonsen eirik at eirikba.org
Fri May 22 02:10:01 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).
v3: Simplifications
  - Inline and remove Free_Thunk_List()
  - Let free() deal with NULL pointers

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 over
night on the resulting binary:

$ valgrind ./xprop -root -spy
[...]
==28142== 
==28142== HEAP SUMMARY:
==28142==     in use at exit: 148,323 bytes in 113 blocks
==28142==   total heap usage: 16,225 allocs, 16,112 frees, 12,687,156 bytes allocated
==28142== 
==28142== LEAK SUMMARY:
==28142==    definitely lost: 0 bytes in 0 blocks
==28142==    indirectly lost: 0 bytes in 0 blocks
==28142==      possibly lost: 0 bytes in 0 blocks
==28142==    still reachable: 148,323 bytes in 113 blocks
==28142==         suppressed: 0 bytes in 0 blocks
==28142== Rerun with --leak-check=full to see details of leaked memory
==28142== 
==28142== For counts of detected and suppressed errors, rerun with: -v
==28142== 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 | 27 +++++++++++++++------------
 1 file changed, 15 insertions(+), 12 deletions(-)

-- 
2.1.4



More information about the xorg-devel mailing list