<html>
<head>
<base href="https://bugs.freedesktop.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - GooString wastes 4 bytes on 64-bit systems"
href="https://bugs.freedesktop.org/show_bug.cgi?id=97506">97506</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>GooString wastes 4 bytes on 64-bit systems
</td>
</tr>
<tr>
<th>Product</th>
<td>poppler
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>Other
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>medium
</td>
</tr>
<tr>
<th>Component</th>
<td>general
</td>
</tr>
<tr>
<th>Assignee</th>
<td>poppler-bugs@lists.freedesktop.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>jakubkucharski97@gmail.com
</td>
</tr></table>
<p>
<div>
<pre>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.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the assignee for the bug.</li>
</ul>
</body>
</html>