Bug 34970

Summary: decides whether to cache a used message based on length, not allocation
Product: dbus Reporter: Simon McVittie <smcv>
Component: coreAssignee: Simon McVittie <smcv>
Status: RESOLVED WONTFIX QA Contact: John (J5) Palmieri <johnp>
Severity: minor    
Priority: low CC: hp
Version: unspecifiedKeywords: patch
Hardware: Other   
OS: All   
URL: http://git.collabora.co.uk/?p=user/smcv/dbus-smcv.git;a=shortlog;h=refs/heads/message-cache-34970
Whiteboard:
i915 platform: i915 features:
Attachments: DBusString: add _dbus_string_get_allocated
DBusMessage: only cache messages that don't have too many bytes allocated

Description Simon McVittie 2011-03-03 04:39:00 UTC
The global message cache in dbus-message.c avoids caching message objects where the total length (header + body) is larger than MAX_MESSAGE_SIZE_TO_CACHE.

However, this doesn't account for possible over-allocations in DBusString: we should probably base the decision on DBusRealString::allocated rather than DBusRealString::length?
Comment 1 Simon McVittie 2011-03-03 04:43:47 UTC
(Please disregard the original title of this bug, which was misleading.)
Comment 2 Simon McVittie 2011-03-07 09:50:32 UTC
Created attachment 44205 [details] [review]
DBusString: add _dbus_string_get_allocated
Comment 3 Simon McVittie 2011-03-07 09:50:51 UTC
Created attachment 44206 [details] [review]
DBusMessage: only cache messages that don't have too many bytes allocated
Comment 4 Lennart Poettering 2011-03-09 19:47:18 UTC
Looks good.

(But is the difference really that big that this matters?)
Comment 5 Simon McVittie 2012-02-21 08:42:47 UTC
(In reply to comment #4)
> (But is the difference really that big that this matters?)

Since messages are effectively add-only, I doubt it.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.