Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Performance of the Darwin 6.6 Libc malloc()



On 28/6/03 10:12 am, Nat! <email@hidden> wrote:

> Am Samstag, 28.06.03 um 10:16 Uhr schrieb Christopher Sean Morrison:
>
>>> Date: Sat, 28 Jun 2003 02:47:22 +0200
>>> Subject: Re: Performance of the Darwin 6.6 Libc malloc()
>>> From: Nat! <email@hidden>
>>> To: email@hidden
>>>
>>> are these graphs supposed to mean, that the more memory is allocated,
>>> the faster the allocation happens ? That'd be one funny malloc. Also
>>> how come the allocation unit size is something like between 100000
>>> bytes and 7e+07, ain't that enormous allocation units ? That doesn't
>>> sound right to me. If its right, who cares how fast that is ? You
>>> usually allocate that big blocks once or twice during the lifetime of
>>> the program. :)
>>
>> The graph is not Time vs. Size, as your first question implies.
>> Vertical
>> value is a rate. The data to compute a Time vs. Size graph is
>> provided in
>> the Logs should that be an interest.
>
> Well mallocs/s is a rate, the number of mallocs made per second. But if
> you read the graph (f.e. Test-Darwin-Linux-IRIX-65536-1048576-Real) it
> says, in pseudocode
>
> for( i = 0; i < 20000; i++)
> malloc( 100000);
>
> runs in a second but it also says
>
> for( i = 0; i < 100000; i++)
> malloc( 1000000);
>
> runs in a second too. That does not make sense.

It might do - if malloc handles requests larger than a certain size by
simply getting a new block of memory that size from the kernel. AIUI, the
kernel doesn't actually grab any pages of VM at this point, it merely
records in some list that a certain number are needed when the memory's
actually used. If the cost of recording the request is cheap enough, then
doing a large malloc without touching the contents of the allocated region
approaches a no-op.

A more interesting test would also write a non-zero byte to each page in the
allocated region, but that would start to test the performance of malloc +
the VM system and not just malloc.

Has anyone tried porting any third-party malloc packages, like the hoard?

Cheers,

Chris
_______________________________________________
darwin-development mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/darwin-development
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: Performance of the Darwin 6.6 Libc malloc() (From: Nat! <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.