FAQ
Hi,

In function zend_hash_init() when allocate no persistent memory (if flag
persistent is 0) for arBuckets element of struct HashTable and virtual
memory is over, the function always returns SUCCESS

Code:

if (persistent) {
tmp = (Bucket **) calloc(ht->nTableSize, sizeof(Bucket *));
if (!tmp) {
return FAILURE;
}
ht->arBuckets = tmp;
} else {
// No checking on return value?
tmp = (Bucket **) ecalloc_rel(ht->nTableSize, sizeof(Bucket *));
if (tmp) {
ht->arBuckets = tmp;
}
}

Search Discussions

  • Antony Dovgal at Apr 28, 2011 at 11:50 am

    On 04/28/2011 02:53 PM, Anton Dobkin wrote:
    // No checking on return value?
    Yes, it doesn't check for NULL.
    See ecalloc() sources in Zend/zend_alloc.c around line 2434 to see why.

    --
    Wbr,
    Antony Dovgal
    ---
    http://pinba.org - realtime statistics for PHP

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupphp-internals @
categoriesphp
postedApr 28, '11 at 10:53a
activeApr 28, '11 at 11:50a
posts2
users2
websitephp.net

2 users in discussion

Anton Dobkin: 1 post Antony Dovgal: 1 post

People

Translate

site design / logo © 2022 Grokbase