English 中文(简体)
PHP模块在帐篷中坠毁
原标题:PHP module crashes on ts_allocate_dtor

我正在使用PHP 5.4.0。

参见ZEND_。 MINIT -FUNCTION

#ifdef ZTS
ts_allocate_id( &sample_globals_id,
    sizeof(zend_sample_globals),
    (ts_allocate_ctor) php_sample_init_globals,
    (ts_allocate_dtor) php_sample_destroy_globals);
#else
    php_sample_init_globals(& sample_globals TSRMLS_CC);
#endif

This code crashes, when module finishes its MSHUTDOWN. GDB points to TSRM.c , this line (the call to dtor):

if (p->storage[j]) {
    if (resource_types_table && !resource_types_table[j].done && resource_types_table[j].dtor) {
    resource_types_table[j].dtor(p->storage[j], &p->storage);
    }
free(p->storage[j]);
}

即便是陌生人,当我以全国人民力量取代代行者职能时,它就发挥了作用。 与此类似:

ts_allocate_id( &sample_globals_id,
    sizeof(zend_sample_globals),
    (ts_allocate_ctor) php_sample_init_globals,
    NULL ); //Works, but destructor is not called

Perhaps anybody has an idea why this could happen? Thank you

问题回答

Found it. Strangely, this is not described in ANY tutorial, but the answer lies in source codes in ext directories.

Ive在MSHUTDOWN上加入下一部法典

#ifdef ZTS
    ts_free_id(sample_globals_id); 
#endif

而现在,它会做罚款。 Phhew...





相关问题
tell gdb to disassemble "unknown" code

is it possible to configure gdb in order to debug assembly code when there are no debug symbols or no sources available ? I mean showing assembly instruction by assembly instruction when performing a ...

C++ Netbeans debugging issues

I installed netbeans6.7.1 ide for c/c++ also i have mingw/msys cygwin installed and i have given C:Msysin as environment variable path.It has gdb7 version.However wheni run dbugging thru netbeans ...

setting strings in gdb

c++: int main() { string a = "a"; ... ... } when i debug in gdb: (gdb) set var a = "ok" Invalid cast I run the program and pause at a break point after string a has been ...

How to debug programms written in fasm under linux using gdb?

I wrote simple "hello, world" in fasm, and its works, but how i can generate debug info for gdb and edb (Evan s Debugger)? Fasm compiler could only produce debugging symbols in its specific format - "...

How can I display Unicode strings while debugging on linux?

I have been working for some years now as C++ Developer using MS Visual Studio as working platform. Since I privately prefer to use linux, I recently took the chance to move my working environment to ...

Continue to debug after failed assertion on Linux?

When an assertion fails with Visual C++ on Windows, the debugger stops, displays the message, and then lets you continue (or, if no debugging session is running, offers to launch visual studio for you)...

热门标签