summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVictor Toso <victortoso@redhat.com>2015-08-19 12:05:46 +0200
committerVictor Toso <victortoso@redhat.com>2015-11-13 08:15:38 +0100
commita263c651e18266c2f05ca9cfff8da886c1603723 (patch)
tree890b0dfc48c0afb8fda7f0032141467e6c953d7d
parent2832fdf25a9a2097efc58545eb389342393562fc (diff)
downloadspice-a263c651e18266c2f05ca9cfff8da886c1603723.tar.gz
spice-a263c651e18266c2f05ca9cfff8da886c1603723.tar.xz
spice-a263c651e18266c2f05ca9cfff8da886c1603723.zip
char-device: free all memory pool when no clients
When no client is connect we should not need to keep the memory pool used by char-device. In most situations this is not significant but when using webdav this could mean freeing MAX_POOL_SIZE bytes Related: https://bugs.freedesktop.org/show_bug.cgi?id=91350
-rw-r--r--server/char_device.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/server/char_device.c b/server/char_device.c
index 3aa88ef3..fe383852 100644
--- a/server/char_device.c
+++ b/server/char_device.c
@@ -826,6 +826,12 @@ void spice_char_device_client_remove(SpiceCharDeviceState *dev,
dev->wait_for_migrate_data = FALSE;
spice_char_device_read_from_device(dev);
}
+
+ if (dev->num_clients == 0) {
+ spice_debug("client removed, memory pool will be freed (%lu bytes)", dev->cur_pool_size);
+ write_buffers_queue_free(&dev->write_bufs_pool);
+ dev->cur_pool_size = 0;
+ }
}
int spice_char_device_client_exists(SpiceCharDeviceState *dev,