On Dec 26, 2015 12:30 PM, "Xinchen Hui" <larue...@php.net> wrote: > > Hey: > > On Sat, Dec 26, 2015 at 1:01 PM, <akin.o...@thomsonreuters.com> wrote: > > > Hi everyone, > > > > I am working on porting a pre-PHP7 database driver extension to PHP7 for > > Windows platforms. > > ( I am using PHP 7.0.1 master branch code and targeting non-ZTS 32 bit > > PHP7 on Windows Server 2012 R2 ) > > And currently as I did mechanical bits of porting ( compilation issues, > > getting functionality working > > mostly followed https://wiki.php.net/phpng-upgrading ) , my extension is > > only crash-free if I run it with > > USE_ZEND_ALLOC=0. > > > > However with USE_ZEND_ALLOC=1 , I am getting crashes inside > > zend_mm_alloc_small. As checked with Windbg : > > ... > > if (EXPECTED(heap->free_slot[bin_num] != NULL) ) > > { > > zend_mm_free_slot *p = > > heap->free_slot[bin_num]; > > if ( p->next_free_slot != NULL ) > > > > Above , p->next_free_slot is not readable. I believe , currently I am > > getting the Zend heap corrupt. > > I am running a test script and I tried disabling many things ,and > > enabling one by one to have an idea, from the looks of it , I am getting > > this issue > > around a zend_register_resource call but to me that one looks legitimate > > so I can`t easily pinpoint where the Zend heap gets corrupt. > > > > Diffrently from pre-PHP7 where we had full_mem_check , now I can see > > ZEND_MM_CHECK is placed in memory manager functions. > > > > I wanted to ask if there is any chance if we can have a heap integrity > > checker function , or what would you advise > > regarding to track down the places in our code corrupting the Zend MM ? > > > I am not familar with windows, but if it can be run in linux > > you could try with "USE_ZEND_ALLOC=0 valgrind --tool=memcheck " > > not sure if there is similar tool on windows > > > thanks >
On windows you can use a couple of tools to try to find them: - http://www.softwareverify.com/ (commercial) - the debugger tools (the standalone tools) contain some limited valgrind like features - not directly related but adding --with-static-analyzer=vs is quite useful too. Latest version is Very effective Cheers,