|
From: | Avi Kivity |
Subject: | Re: [Qemu-devel] [PATCH] Permit zero-sized qemu_malloc() & friends |
Date: | Sun, 06 Dec 2009 14:07:06 +0200 |
User-agent: | Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.5) Gecko/20091203 Fedora/3.0-3.13.rc2.fc12 Thunderbird/3.0 |
On 12/06/2009 01:53 PM, malc wrote:
On Sun, 6 Dec 2009, Avi Kivity wrote:On 12/06/2009 12:22 PM, malc wrote:Here, i believe, you are inventing artificial restrictions on how malloc behaves, i don't see anything that prevents the implementor from setting aside a range of addresses with 31st bit set as an indicator of "zero" allocations, and then happily giving it to the user of malloc and consumming it in free.The implementation needs to track which addresses it handed out, since it is required that malloc(0) != malloc(0) (unless both are NULL).You haven't read carefully, i said range.
I did in fact. Consider a loop malloc(0); p = malloc(0); while (1) { n = malloc(0); free(p); p = n; }without some form of tracking, you won't be able to return unique addresses eventually.
-- error compiling committee.c: too many arguments to function
[Prev in Thread] | Current Thread | [Next in Thread] |