[Spice-devel] [spice-server PATCH v1 3/3] char-device: free all memory pool when no clients
Victor Toso
victortoso at redhat.com
Thu Aug 20 07:20:40 PDT 2015
When no client is connect we should not need to keep the memory pool
used by char-device. On most situations this is not significante but
when using webdav this could mean freeing MAX_POOL_SIZE bytes
Related: https://bugs.freedesktop.org/show_bug.cgi?id=91350
---
server/char_device.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/server/char_device.c b/server/char_device.c
index 5eda89c..d757d9b 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,
--
2.4.3
More information about the Spice-devel
mailing list