[PATCH wayland] protocol: Suggest get_registry not be called frequently

Derek Foreman derekf at osg.samsung.com
Fri Sep 29 18:46:28 UTC 2017


I've heard some complaints that wl_display.get_registry "leaks"
server memory because wl_registry has no destructor.  While this isn't
strictly true - all those resources are freed when the client
disconnects - it's a bit of a gotcha for neophytes.

Since wl_registry's version is not requested in any way through
wl_display.get_registry, we can't add a destructor request without
breaking ABI.  So let's be a little more clear about the result
of getting too many wl_registry objects.

Signed-off-by: Derek Foreman <derekf at osg.samsung.com>
---
 protocol/wayland.xml | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/protocol/wayland.xml b/protocol/wayland.xml
index 29b63be..aabc7ae 100644
--- a/protocol/wayland.xml
+++ b/protocol/wayland.xml
@@ -57,6 +57,12 @@
 	This request creates a registry object that allows the client
 	to list and bind the global objects available from the
 	compositor.
+
+	It should be noted that the server side resources consumed in
+	response to a get_registry request can only be released when the
+	client disconnects, not when the client side proxy is destroyed.
+	Therefore, clients should invoke get_registry as infrequently as
+	possible to avoid wasting memory.
       </description>
       <arg name="registry" type="new_id" interface="wl_registry"
 	   summary="global registry object"/>
-- 
2.14.1



More information about the wayland-devel mailing list