143
143
* previous freenode
144
144
*/
145
145
146
- #define MM_ALLOCNODE_OVERHEAD (MM_SIZEOF_ALLOCNODE - sizeof(mmsize_t))
146
+ #ifdef CONFIG_MM_NODE_PENDING
147
+ # define MM_NODE_PENDING aligned_data(MM_ALIGN)
148
+ # define MMSIZE_T_LEN MM_ALIGN
149
+ #else
150
+ # define MM_NODE_PENDING
151
+ # define MMSIZE_T_LEN sizeof(mmsize_t)
152
+ #endif
153
+
154
+ #define MM_ALLOCNODE_OVERHEAD (MM_SIZEOF_ALLOCNODE - MMSIZE_T_LEN)
147
155
148
156
/* Get the node size */
149
157
@@ -173,23 +181,41 @@ typedef size_t mmsize_t;
173
181
174
182
struct mm_allocnode_s
175
183
{
176
- mmsize_t preceding ; /* Physical preceding chunk size */
177
- mmsize_t size ; /* Size of this chunk */
184
+ union
185
+ {
186
+ mmsize_t preceding ; /* Physical preceding chunk size */
187
+ uint8_t preceding_align [MMSIZE_T_LEN ];
188
+ };
189
+ union
190
+ {
191
+ mmsize_t size ; /* Physical preceding chunk size */
192
+ uint8_t size_align [MMSIZE_T_LEN ];
193
+ };
194
+
178
195
#if CONFIG_MM_BACKTRACE >= 0
179
196
pid_t pid ; /* The pid for caller */
180
197
unsigned long seqno ; /* The sequence of memory malloc */
181
198
# if CONFIG_MM_BACKTRACE > 0
182
199
FAR void * backtrace [CONFIG_MM_BACKTRACE ]; /* The backtrace buffer for caller */
183
200
# endif
184
201
#endif
185
- };
202
+ }MM_NODE_PENDING ;
186
203
187
204
/* This describes a free chunk */
188
205
189
206
struct mm_freenode_s
190
207
{
191
- mmsize_t preceding ; /* Physical preceding chunk size */
192
- mmsize_t size ; /* Size of this chunk */
208
+ union
209
+ {
210
+ mmsize_t preceding ; /* Physical preceding chunk size */
211
+ uint8_t preceding_align [MMSIZE_T_LEN ];
212
+ };
213
+ union
214
+ {
215
+ mmsize_t size ; /* Physical preceding chunk size */
216
+ uint8_t size_align [MMSIZE_T_LEN ];
217
+ };
218
+
193
219
#if CONFIG_MM_BACKTRACE >= 0
194
220
pid_t pid ; /* The pid for caller */
195
221
unsigned long seqno ; /* The sequence of memory malloc */
@@ -199,7 +225,7 @@ struct mm_freenode_s
199
225
#endif
200
226
FAR struct mm_freenode_s * flink ; /* Supports a doubly linked list */
201
227
FAR struct mm_freenode_s * blink ;
202
- };
228
+ }MM_NODE_PENDING ;
203
229
204
230
static_assert (MM_SIZEOF_ALLOCNODE <= MM_MIN_CHUNK ,
205
231
"Error size for struct mm_allocnode_s\n" );
0 commit comments