[spice-server PATCH v1 3/3] char-device: free all memory pool when no clients

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]