[Poppler-bugs] [Bug 97506] New: GooString wastes 4 bytes on 64-bit systems
bugzilla-daemon at freedesktop.org
bugzilla-daemon at freedesktop.org
Sat Aug 27 04:30:21 UTC 2016
https://bugs.freedesktop.org/show_bug.cgi?id=97506
Bug ID: 97506
Summary: GooString wastes 4 bytes on 64-bit systems
Product: poppler
Version: unspecified
Hardware: Other
OS: All
Status: NEW
Severity: normal
Priority: medium
Component: general
Assignee: poppler-bugs at lists.freedesktop.org
Reporter: jakubkucharski97 at gmail.com
GooString has 3 fields:
char sStatic[STR_STATIC_SIZE];
int length;
char *s;
32-bit system without the patches:
STR_STATIC_SIZE: 24
sizeof(MemoryLayout): 12
sizeof(char*): 4
sizeof(int): 4
sizeof(GooString): 32
------------------------
Used = STR_STATIC_SIZE + sizeof(int) + sizeof(char*) = 24 + 4 + 4 = 32 out of
32 taken (100% efficiency)
64-bit system without the patches:
STR_STATIC_SIZE: 16
sizeof(MemoryLayout): 24
sizeof(char*): 8
sizeof(int): 4
sizeof(GooString): 32
------------------------
Used = STR_STATIC_SIZE + sizeof(int) + sizeof(char*) = 16 + 4 + 8 = 28 out of
32 taken (87.5% efficiency)
Right now STR_STATIC_SIZE is calculated using class MemoryLayout which doesn't
help, but only makes it harder due to memory alignment performed by the
compiler (sizeof(MemoryLayout) on a 64-bit system >= the sum of MemoryLayout's
fields sizes).
With my patches sizeof(GooString) is still == 32, and there are no wasted
bytes.
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/poppler-bugs/attachments/20160827/321d92c4/attachment.html>
More information about the Poppler-bugs
mailing list