PHP extension dealing with array cause crash

From: Date: Thu, 03 Jan 2008 22:39:58 +0000
Subject: PHP extension dealing with array cause crash
Groups: php.pecl.dev 
Request: Send a blank email to pecl-dev+get-5018@lists.php.net to get a copy of this message
Implemented a simple php extension function that return an array of arrays. A php page that call the function and repeatedly echo the content works fine until the page is executed frequently (simply by holding F5 on the browser) it will cause a crash in inetinfo. Below is the very simple code that demo the problem. Some how if I remove the try/catch or reduce the array size, it happen less often. ZEND_FUNCTION(GetProperty) { zval* objectEntry; array_init(return_value); zend_first_try {
    for (int t=0; t<500; t++)
      {
        MAKE_STD_ZVAL(objectEntry);
        array_init(objectEntry);
        add_next_index_string(objectEntry,
"TestEntryTestEntryTestEntryTestEntryTestEntryTestEntryTestEntryTestEntry", 1);
        add_next_index_string(objectEntry,
"000000000000000000000000000000000000000000000000000000000000000000000000", 1);
        add_next_index_zval(return_value, objectEntry);
      }
} zend_catch { } zend_end_try(); } --------------------------- <?php for ($X=1; $X<25; $X++) {
    echo "Memory Usage:" , memory_get_usage(), "/", memory_get_peak_usage(),
"<br>";
    $Result = GetProperty(".*");
    foreach ($Result as $ObjectResult)
    {
      echo $ObjectResult[0], "(" , $ObjectResult[1], ")", ",";
    }
    echo "<br>";
} ?> ---------------------------- In IIS, setup the website to use Low(IIS Process). Browser the page and hit F5 in the browser to refresh the page. it will crash inetinfo. Runtime Error! R6030 - CRT not initialized I am new to php extension, any help is appreciated. Thanks! Tony

« previous php.pecl.dev (#5018) next »