Start cleaning objects on destruction

Submitted by Pavel Grunt on Nov. 24, 2016, 5:38 p.m.

Details

Reviewer None
Submitted Nov. 24, 2016, 5:38 p.m.
Last Updated Dec. 5, 2016, 12:16 p.m.
Revision 7

Cover Letter(s)

Revision 1
      These patches start destroying objects upon destruction.
Lot of the objects are just allocated but never freed.
This however make hardier to understand automatically leaks
as objects are still linked together.
Currently spice_server_destroy is not called so objects
are freed only when program ends by the operating system.
These patches allows using automated testing and some memory
leak detectors (Valgrind, address sanitizer or others) to be
used to discover possible leaks.

Frediano Ziglio (20):
  add a red_memslot_info_destroy function
  red_worker: add RED_WORKER_MESSAGE_CLOSE_WORKER message
  Free statistic file on spice_server_destroy
  Free state on spice_server_destroy
  Use red_channel_destroy to free main_channel
  Do not leak mig_timer
  Remove unused and obsolete main_channel_close
  Return invalid value from very old obsolete functions
  Remove unused red_channel_get_first_socket
  Avoid to leak timer in InputsChannel
  Reuse reds_core_timer_add
  Add red_qxl_destroy function
  Support QXL remove on spice_server_remove_interface
  Rearrange object destruction
  Free QXL instances in spice_server_destroy
  replay: Free spice server to detect leaks
  cursor: Avoid cursor item leak
  Allows reds_core_timer_remove to accept NULL for timer
  Free replay queues
  Free properly primary surface during replay

 server/char-device.c          | 20 +++++++---------
 server/cursor-channel.c       | 15 ++++++++++++
 server/display-channel.c      |  4 ++--
 server/inputs-channel.c       | 12 ++++++++++
 server/main-channel-client.c  |  8 ++-----
 server/main-channel.c         | 18 ++++-----------
 server/main-channel.h         |  1 -
 server/memslot.c              | 10 ++++++++
 server/memslot.h              |  1 +
 server/red-channel.c          | 14 ------------
 server/red-channel.h          |  2 --
 server/red-qxl.c              | 25 +++++++++++++++++---
 server/red-qxl.h              |  7 ++++++
 server/red-replay-qxl.c       |  6 +++++
 server/red-worker.c           | 53 ++++++++++++++++++++++++++++++++++++++++---
 server/red-worker.h           |  1 +
 server/reds.c                 | 45 ++++++++++++++++++++++++++++--------
 server/stat-file.c            | 17 ++++++++++++++
 server/stat-file.h            |  1 +
 server/tests/replay.c         | 21 ++++++++++++++---
 server/tests/stat-file-test.c |  2 ++
 21 files changed, 214 insertions(+), 69 deletions(-)
    
Revision 2
      These patches start destroying objects upon destruction.
Lot of the objects are just allocated but never freed.
This however make hardier to understand automatically leaks
as objects are still linked together.
Currently spice_server_destroy is not called so objects
are freed only when program ends by the operating system.
These patches allows using automated testing and some memory
leak detectors (Valgrind, address sanitizer or others) to be
used to discover possible leaks.

Changes since v1:
- removed a merged patch;
- more comments on "red_worker: add RED_WORKER_MESSAGE_CLOSE_WORKER
  message";
- avoid a crash if main_dispatcher is not initialized.

Frediano Ziglio (19):
  red_worker: add RED_WORKER_MESSAGE_CLOSE_WORKER message
  Free statistic file on spice_server_destroy
  Free state on spice_server_destroy
  Use red_channel_destroy to free main_channel
  Do not leak mig_timer
  Remove unused and obsolete main_channel_close
  Return invalid value from very old obsolete functions
  Remove unused red_channel_get_first_socket
  Avoid to leak timer in InputsChannel
  Reuse reds_core_timer_add
  Add red_qxl_destroy function
  Support QXL remove on spice_server_remove_interface
  Rearrange object destruction
  Free QXL instances in spice_server_destroy
  replay: Free spice server to detect leaks
  cursor: Avoid cursor item leak
  Allows reds_core_timer_remove to accept NULL for timer
  Free replay queues
  Free properly primary surface during replay

 server/char-device.c          | 20 +++++---------
 server/cursor-channel.c       | 15 ++++++++++-
 server/display-channel.c      |  4 +--
 server/inputs-channel.c       | 12 ++++++++-
 server/main-channel-client.c  |  8 +----
 server/main-channel.c         | 18 ++----------
 server/main-channel.h         |  1 +-
 server/red-channel.c          | 14 +----------
 server/red-channel.h          |  2 +-
 server/red-qxl.c              | 25 ++++++++++++++---
 server/red-qxl.h              |  7 +++++-
 server/red-replay-qxl.c       |  6 ++++-
 server/red-worker.c           | 53 +++++++++++++++++++++++++++++++++---
 server/red-worker.h           |  1 +-
 server/reds.c                 | 47 +++++++++++++++++++++++++-------
 server/stat-file.c            | 17 ++++++++++++-
 server/stat-file.h            |  1 +-
 server/tests/replay.c         | 21 ++++++++++++--
 server/tests/test-stat-file.c |  2 +-
 19 files changed, 205 insertions(+), 69 deletions(-)

base-commit: f275733de30f6ed4f4cd546031008c9f9a7f11f2
    
Revision 5
      These patches start destroying objects upon destruction.
Lot of the objects are just allocated but never freed.
This however make hardier to understand automatically leaks
as objects are still linked together.
Currently spice_server_destroy is not called so objects
are freed only when program ends by the operating system.
These patches allows using automated testing and some memory
leak detectors (Valgrind, address sanitizer or others) to be
used to discover possible leaks.

Changes since v2:
- merged different patches;
- move "Support QXL remove on spice_server_remove_interface"
  at the top;
- added some comments.

Changes since v1:
- removed a merged patch;
- more comments on "red_worker: add RED_WORKER_MESSAGE_CLOSE_WORKER
  message";
- avoid a crash if main_dispatcher is not initialized.

Frediano Ziglio (7):
  Add red_qxl_destroy function
  Rearrange object destruction
  Free QXL instances in spice_server_destroy
  replay: Free spice server to detect leaks
  Free replay queues
  Free properly primary surface during replay
  Support QXL remove on spice_server_remove_interface

 server/display-channel.c |  4 ++--
 server/red-qxl.c         | 25 ++++++++++++++++++++++---
 server/red-qxl.h         |  1 +
 server/red-replay-qxl.c  |  6 ++++++
 server/red-worker.c      | 35 ++++++++++++++++++++++++++++++++++-
 server/red-worker.h      |  1 +
 server/reds.c            | 38 ++++++++++++++++++++++++++++----------
 server/tests/replay.c    | 21 ++++++++++++++++++---
 8 files changed, 112 insertions(+), 19 deletions(-)

base-commit: 1f800090ef671e9fccb49ed64c01a85b6eb0890a
    
Revision 6
      These patches start destroying objects upon destruction.
Lot of the objects are just allocated but never freed.
This however make hardier to understand automatically leaks
as objects are still linked together.
Currently spice_server_destroy is not called so objects
are freed only when program ends by the operating system.
These patches allows using automated testing and some memory
leak detectors (Valgrind, address sanitizer or others) to be
used to discover possible leaks.

Changes since v3:
- removed a merged patch;
- split "Rearrange object destruction" adding needed
  comments.

Changes since v2:
- merged different patches;
- move "Support QXL remove on spice_server_remove_interface"
  at the top;
- added some comments.

Changes since v1:
- removed a merged patch;
- more comments on "red_worker: add RED_WORKER_MESSAGE_CLOSE_WORKER
  message";
- avoid a crash if main_dispatcher is not initialized.

Frediano Ziglio (7):
  Call parent finalize at the and of display_channel_finalize
  Free inputs_channel in spice_server_destroy
  Free QXL instances in spice_server_destroy
  replay: Free spice server to detect leaks
  Free replay queues
  Free properly primary surface during replay
  Support QXL remove on spice_server_remove_interface

 server/display-channel.c |  4 ++--
 server/red-replay-qxl.c  |  6 ++++++
 server/reds.c            | 18 ++++++++++++++++++
 server/tests/replay.c    | 21 ++++++++++++++++++---
 4 files changed, 44 insertions(+), 5 deletions(-)

base-commit: 98f6767483a0fb1f0167a911a8169518c02fc025
    
Revision 7
      These patches start destroying objects upon destruction.
Lot of the objects are just allocated but never freed.
This however make hardier to understand automatically leaks
as objects are still linked together.
Currently spice_server_destroy is not called so objects
are freed only when program ends by the operating system.
These patches allows using automated testing and some memory
leak detectors (Valgrind, address sanitizer or others) to be
used to discover possible leaks.

Changes since v4:
- added some comments;
- merged some patches;
- split some patches containing multiple cleanups.

Changes since v3:
- removed a merged patch;
- split "Rearrange object destruction" adding needed
  comments.

Changes since v2:
- merged different patches;
- move "Support QXL remove on spice_server_remove_interface"
  at the top;
- added some comments.

Changes since v1:
- removed a merged patch;
- more comments on "red_worker: add RED_WORKER_MESSAGE_CLOSE_WORKER
  message";
- avoid a crash if main_dispatcher is not initialized.

Frediano Ziglio (8):
  Call parent finalize at the and of display_channel_finalize
  Free inputs_channel in spice_server_destroy
  Free QXL instances in spice_server_destroy
  Free main_dispatcher in spice_server_destroy
  replay: Free spice server to detect leaks
  Free replay queues
  Free properly primary surface during replay
  Support QXL remove on spice_server_remove_interface

 server/display-channel.c |  4 ++--
 server/red-replay-qxl.c  |  6 ++++++
 server/reds.c            | 18 ++++++++++++++++++
 server/tests/replay.c    | 21 ++++++++++++++++++---
 4 files changed, 44 insertions(+), 5 deletions(-)

base-commit: f870f0f0306342911197e4b7320b69130c1627ab
    

Revisions

Patches download mbox

# Name Submitter State A F R T
[Spice-devel,spice-server,01/20] add a red_memslot_info_destroy function Frediano Ziglio New
[Spice-devel,spice-server,02/20] red_worker: add RED_WORKER_MESSAGE_CLOSE_WORKER message Frediano Ziglio Accepted
[Spice-devel,spice-server,03/20] Free statistic file on spice_server_destroy Frediano Ziglio New
[Spice-devel,spice-server,04/20] Free state on spice_server_destroy Frediano Ziglio Accepted
[Spice-devel,spice-server,05/20] Use red_channel_destroy to free main_channel Frediano Ziglio Accepted
[Spice-devel,spice-server,06/20] Do not leak mig_timer Frediano Ziglio Accepted
[Spice-devel,spice-server,07/20] Remove unused and obsolete main_channel_close Frediano Ziglio New
[Spice-devel,spice-server,08/20] Return invalid value from very old obsolete functions Frediano Ziglio New
[Spice-devel,spice-server,09/20] Remove unused red_channel_get_first_socket Frediano Ziglio Accepted
[Spice-devel,spice-server,10/20] Avoid to leak timer in InputsChannel Frediano Ziglio Accepted
[Spice-devel,spice-server,11/20] Reuse reds_core_timer_add Frediano Ziglio Accepted
[Spice-devel,spice-server,12/20] Add red_qxl_destroy function Frediano Ziglio New
[Spice-devel,spice-server,13/20] Support QXL remove on spice_server_remove_interface Frediano Ziglio Accepted
[Spice-devel,spice-server,14/20] Rearrange object destruction Frediano Ziglio New
[Spice-devel,spice-server,15/20] Free QXL instances in spice_server_destroy Frediano Ziglio Superseded
[Spice-devel,spice-server,16/20] replay: Free spice server to detect leaks Frediano Ziglio Accepted
[Spice-devel,spice-server,17/20] cursor: Avoid cursor item leak Frediano Ziglio Accepted
[Spice-devel,spice-server,18/20] Allows reds_core_timer_remove to accept NULL for timer Frediano Ziglio New
[Spice-devel,spice-server,19/20] Free replay queues Frediano Ziglio Accepted
[Spice-devel,spice-server,20/20] Free properly primary surface during replay Frediano Ziglio Accepted

Patches download mbox

# Name Submitter State A F R T
[Spice-devel,v2,01/19] red_worker: add RED_WORKER_MESSAGE_CLOSE_WORKER message Frediano Ziglio Accepted 1
[Spice-devel,v2,02/19] Free statistic file on spice_server_destroy Frediano Ziglio Accepted 1
[Spice-devel,v2,03/19] Free state on spice_server_destroy Frediano Ziglio New 1
[Spice-devel,v2,04/19] Use red_channel_destroy to free main_channel Frediano Ziglio New 1
[Spice-devel,v2,05/19] Do not leak mig_timer Frediano Ziglio New 1
[Spice-devel,v2,06/19] Remove unused and obsolete main_channel_close Frediano Ziglio New 1
[Spice-devel,v2,07/19] Return invalid value from very old obsolete functions Frediano Ziglio New
[Spice-devel,v2,08/19] Remove unused red_channel_get_first_socket Frediano Ziglio New 1
[Spice-devel,v2,09/19] Avoid to leak timer in InputsChannel Frediano Ziglio New 1
[Spice-devel,v2,10/19] Reuse reds_core_timer_add Frediano Ziglio New 1
[Spice-devel,v2,11/19] Add red_qxl_destroy function Frediano Ziglio New
[Spice-devel,v2,12/19] Support QXL remove on spice_server_remove_interface Frediano Ziglio Superseded
[Spice-devel,v2,13/19] Rearrange object destruction Frediano Ziglio New
[Spice-devel,v2,14/19] Free QXL instances in spice_server_destroy Frediano Ziglio Superseded
[Spice-devel,v2,15/19] replay: Free spice server to detect leaks Frediano Ziglio Superseded 1
[Spice-devel,v2,16/19] cursor: Avoid cursor item leak Frediano Ziglio Accepted 1
[Spice-devel,v2,17/19] Allows reds_core_timer_remove to accept NULL for timer Frediano Ziglio New
[Spice-devel,v2,18/19] Free replay queues Frediano Ziglio Superseded 1
[Spice-devel,v2,19/19] Free properly primary surface during replay Frediano Ziglio Superseded 1
SERIES REVISION LOOKS STRANGE. Please double-check patch list and the ordering before proceeding.

Patches download mbox

# Name Submitter State A F R T
[Spice-devel,v2,01/19] red_worker: add RED_WORKER_MESSAGE_CLOSE_WORKER message Frediano Ziglio Accepted 1
[Spice-devel,v2,02/19] Free statistic file on spice_server_destroy Frediano Ziglio Accepted 1
[Spice-devel,v2,03/19] Free state on spice_server_destroy Frediano Ziglio New 1
[Spice-devel,v2,04/19] Use red_channel_destroy to free main_channel Frediano Ziglio New 1
[Spice-devel,v2,05/19] Do not leak mig_timer Frediano Ziglio New 1
[Spice-devel,v2,06/19] Remove unused and obsolete main_channel_close Frediano Ziglio New 1
[Spice-devel,spice-server,v3] Return invalid value from very old obsolete functions Frediano Ziglio New 1
[Spice-devel,v2,08/19] Remove unused red_channel_get_first_socket Frediano Ziglio New 1
[Spice-devel,v2,09/19] Avoid to leak timer in InputsChannel Frediano Ziglio New 1
[Spice-devel,v2,10/19] Reuse reds_core_timer_add Frediano Ziglio New 1
[Spice-devel,v2,11/19] Add red_qxl_destroy function Frediano Ziglio New
[Spice-devel,v2,12/19] Support QXL remove on spice_server_remove_interface Frediano Ziglio Superseded
[Spice-devel,v2,13/19] Rearrange object destruction Frediano Ziglio New
[Spice-devel,v2,14/19] Free QXL instances in spice_server_destroy Frediano Ziglio Superseded
[Spice-devel,v2,15/19] replay: Free spice server to detect leaks Frediano Ziglio Superseded 1
[Spice-devel,v2,16/19] cursor: Avoid cursor item leak Frediano Ziglio Accepted 1
[Spice-devel,v2,17/19] Allows reds_core_timer_remove to accept NULL for timer Frediano Ziglio New
[Spice-devel,v2,18/19] Free replay queues Frediano Ziglio Superseded 1
[Spice-devel,v2,19/19] Free properly primary surface during replay Frediano Ziglio Superseded 1
SERIES REVISION LOOKS STRANGE. Please double-check patch list and the ordering before proceeding.

Patches download mbox

# Name Submitter State A F R T
[Spice-devel,v2,01/19] red_worker: add RED_WORKER_MESSAGE_CLOSE_WORKER message Frediano Ziglio Accepted 1
[Spice-devel,v2,02/19] Free statistic file on spice_server_destroy Frediano Ziglio Accepted 1
[Spice-devel,v2,03/19] Free state on spice_server_destroy Frediano Ziglio New 1
[Spice-devel,v2,04/19] Use red_channel_destroy to free main_channel Frediano Ziglio New 1
[Spice-devel,v2,05/19] Do not leak mig_timer Frediano Ziglio New 1
[Spice-devel,v2,06/19] Remove unused and obsolete main_channel_close Frediano Ziglio New 1
[Spice-devel,spice-server,v3] Return invalid value from very old obsolete functions Frediano Ziglio New 1
[Spice-devel,v2,08/19] Remove unused red_channel_get_first_socket Frediano Ziglio New 1
[Spice-devel,v2,09/19] Avoid to leak timer in InputsChannel Frediano Ziglio New 1
[Spice-devel,v2,10/19] Reuse reds_core_timer_add Frediano Ziglio New 1
[Spice-devel,v2,11/19] Add red_qxl_destroy function Frediano Ziglio New
[Spice-devel,v2,12/19] Support QXL remove on spice_server_remove_interface Frediano Ziglio Superseded
[Spice-devel,v2,13/19] Rearrange object destruction Frediano Ziglio New
[Spice-devel,v2,14/19] Free QXL instances in spice_server_destroy Frediano Ziglio Superseded
[Spice-devel,v2,15/19] replay: Free spice server to detect leaks Frediano Ziglio Superseded 1
[Spice-devel,v2,16/19] cursor: Avoid cursor item leak Frediano Ziglio Accepted 1
[Spice-devel] fixup! Allows reds_core_timer_remove to accept NULL for timer Pavel Grunt New
[Spice-devel,v2,18/19] Free replay queues Frediano Ziglio Superseded 1
[Spice-devel,v2,19/19] Free properly primary surface during replay Frediano Ziglio Superseded 1