[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [patches] malloc & madvise
- To: "Joseph S. Myers" <joseph@xxxxxxxxxxxxxxxx>
- Subject: Re: [patches] malloc & madvise
- From: Maxim Kuvyrkov <maxim@xxxxxxxxxxxxxxxx>
- Date: Wed, 18 Nov 2009 20:57:38 +0300
Joseph S. Myers wrote:
On Tue, 17 Nov 2009, Richard Kralovic wrote:
...
Are there any other caveats with this approach?
I don't know of any, but as I said I am not an expert on the malloc
implementation; I encourage other readers to comment.
I have a couple of questions about handling of free_blocks. Here is the
definition:
struct free_block {
/* Lenght of the block */
INTERNAL_SIZE_T size;
/* Circular doubly linked list within the chunk. */
struct free_block *bk_chunk, *fd_chunk;
/* Circular doubly linked list of blocks sorted by creation time. */
struct free_block *bk_time, *fd_time;
};
/* End of the given free_block. */
#define BLOCK_END(p) ((void *)(p) + (p)->size)
1. You're assuming the fact that nothing else in malloc uses free()d
chunks, so you're hosting free_block nodes in that space. I'm a bit
worried about how safe this approach is.
2. Some architectures have certain alignment requirements for
structures, so is it the case that free()d chunks will have appropriate
alignment to host a structure at the beginning?
Regards,
--
Maxim Kuvyrkov
CodeSourcery
maxim@xxxxxxxxxxxxxxxx
(650) 331-3385 x724