site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com The test program I included in my original psoting, however, tries all sizes from 1 bytes to 16mb without coming across a case where the routine returns a non-zero value. Works for me on Leopard 10.5.2 . ------ // cc -Wall --std=c99 -o mzm mzm.c #include <stdio.h> #include <malloc/malloc.h> static size_t do_experiment (malloc_zone_t *z, size_t size_bound) { size_t ret_val = 0; void *v[ 2 ]; for (size_t size = 1; size < size_bound; size++) { unsigned allocated = malloc_zone_batch_malloc ( z, size, v, 2 ); if (allocated) { ret_val = size; break; } } return ret_val; } /* do_experiment */ int main (int argc, const char *argv []) { size_t size_bound = 16 * 1024 * 1024; malloc_zone_t *z = malloc_default_zone(); size_t size = do_experiment(z, size_bound); printf("do_experiment to size %zd returned %zd\n", size_bound, size); return 0; } ------- % cc -Wall --std=c99 -o mzm mzm.c % ./mzm do_experiment to size 16777216 returned 1 ------- Eric Ariel Burton == On Wed 21 May 16:37, Terry Lambert wrote: In what circumstances is malloc_zone_batch_malloc supposed to return any memory? _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/eric.gouriou%40pobox.com _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/site_archiver%40lists.appl... On May 21, 2008, at 5:03 PM, Ariel Burton wrote: Am I missing something? Of course I may have failed reading comprehension 201 this time around... On May 21, 2008, at 2:00 PM, Ariel Burton wrote: <http://developer.apple.com/documentation/Performance/Conceptual/ManagingMemo... "f your code allocates multiple, identically-sized memory blocks, you can use the malloc_zone_batch_malloc function to allocate those blocks all at once. This function offers better performance than the equivalent series of calls to malloc to allocate the same memory. Performance is best when the individual block size is relatively small— less than 4K in size. The function does its best to allocate all of the requested memory but may return less than was requested. When using this function, check the return values carefully to see how many blocks were actually allocated." -- Terry This email sent to eric.gouriou@pobox.com This email sent to site_archiver@lists.apple.com