Skip to content

internal zval's can't be arrays, objects or resources #161

Description

@jank9201

I build the master version with php 7.1.33, and comment all other class in PHP_RINIT_FUNCTION(php_wxWidgets)
except the zval z_wxNullBitmap;
when I ran the php, I got the error message "internal zval's can't be arrays, objects or resources"
the debug message was
"c:\build\phpdev\vc14\x64\php7\ext\php_wxwidgets\wxphp\src\gdi.cpp(4284) : Freeing 0x0000000005c5b070 (72 bytes), script=-
Zend\zend_alloc.c(2488) : Actual location (location was relayed)"
my build tools was vs2015,
anybody who can tell how to fix the bug? please!

Activity

  1. jank9201 commented on Sep 28, 2020

    @jank9201
    Author

    in
    void wxphp_register_object_constant(const char *name, zval object, int flags, int module_number)
    if comment ZVAL_COPY(&c.value, &object);
    no error message trigger, so is there some place we should release the the allocate memory?

  2. jank9201 commented on Sep 30, 2020

    @jank9201
    Author

    debug with vld
    WARNING: Visual Leak Detector detected memory leaks!
    ---------- Block 6559 at 0x00000000042E0DA0: 136 bytes ----------
    Leak Hash: 0x62B30A3E, Count: 1, Total 136 bytes
    Call Stack (TID 1088):
    f:\dd\vctools\crt\vcstartup\src\heap\new_scalar.cpp (19): php_wxwidgets.dll!operator new() + 0xA bytes
    c:\wxwidgets-3.0.5\src\msw\gdiimage.cpp (342): php_wxwidgets.dll!wxGDIImage::InitStandardHandlers() + 0xA bytes
    c:\wxwidgets-3.0.5\src\common\appcmn.cpp (115): php_wxwidgets.dll!wxAppBase::Initialize()
    c:\wxwidgets-3.0.5\src\msw\app.cpp (635): php_wxwidgets.dll!wxApp::Initialize() + 0x14 bytes
    c:\wxwidgets-3.0.5\src\common\init.cpp (333): php_wxwidgets.dll!wxEntryStart() + 0x32 bytes
    c:\wxwidgets-3.0.5\src\common\init.cpp (542): php_wxwidgets.dll!wxInitialize() + 0xF bytes
    c:\wxwidgets-3.0.5\src\common\init.cpp (530): php_wxwidgets.dll!wxInitialize()
    c:\build\phpdev\vc14\x64\php7\ext\php_wxwidgets\wxphp\wxwidgets.cpp (1501): php_wxwidgets.dll!zm_activate_php_wxWidgets()
    c:\build\phpdev\vc14\x64\php7\zend\zend_api.c (2539): php7ts_debug.dll!zend_activate_modules() + 0x21 bytes
    c:\build\phpdev\vc14\x64\php7\main\main.c (1699): php7ts_debug.dll!php_request_startup()
    c:\build\phpdev\vc14\x64\php7\sapi\cgi\cgi_main.c (2545): php-cgi.exe!main() + 0x6 bytes
    f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl (65): php-cgi.exe!invoke_main()
    f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl (253): php-cgi.exe!__scrt_common_main_seh() + 0x5 bytes
    f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl (296): php-cgi.exe!__scrt_common_main()
    f:\dd\vctools\crt\vcstartup\src\startup\exe_main.cpp (17): php-cgi.exe!mainCRTStartup()
    kernel32.dll!BaseThreadInitThunk() + 0xD bytes
    ntdll.dll!RtlUserThreadStart() + 0x1D bytes
    Data:
    D8 93 37 E4 FE 07 00 00 00 00 00 00 00 00 00 00 ..7..... ........
    50 0D BF 06 00 00 00 00 50 B9 BC 06 00 00 00 00 P....... P.......
    CD CD CD CD CD CD CD CD 17 00 00 00 00 00 00 00 ........ ........
    17 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........
    CD CD CD CD CD CD CD CD A0 0D BF 06 00 00 00 00 ........ ........
    00 00 CD CD CD CD CD CD CD CD CD CD CD CD CD CD ........ ........
    00 00 00 00 00 00 00 00 07 00 00 00 00 00 00 00 ........ ........
    00 00 00 00 00 00 00 00 CD CD CD CD CD CD CD CD ........ ........
    02 00 00 00 CD CD CD CD ........ ........

    ---------- Block 7499 at 0x00000000042F3670: 224 bytes ----------
    Leak Hash: 0x1339EF38, Count: 1, Total 224 bytes
    Call Stack (TID 1088):
    f:\dd\vctools\crt\vcstartup\src\heap\new_scalar.cpp (19): php_wxwidgets.dll!operator new() + 0xA bytes
    c:\wxwidgets-3.0.5\src\common\image.cpp (2904): php_wxwidgets.dll!wxImage::InitStandardHandlers() + 0xA bytes
    c:\wxwidgets-3.0.5\src\common\image.cpp (3658): php_wxwidgets.dll!wxImageModule::OnInit() + 0xE bytes
    c:\wxwidgets-3.0.5\include\wx\module.h (40): php_wxwidgets.dll!wxModule::Init() + 0x19 bytes
    c:\wxwidgets-3.0.5\src\common\module.cpp (131): php_wxwidgets.dll!wxModule::DoInitializeModule() + 0xD bytes
    c:\wxwidgets-3.0.5\src\common\module.cpp (162): php_wxwidgets.dll!wxModule::InitializeModules() + 0xF bytes
    c:\wxwidgets-3.0.5\src\common\init.cpp (285): php_wxwidgets.dll!DoCommonPostInit() + 0x5 bytes
    c:\wxwidgets-3.0.5\src\common\init.cpp (347): php_wxwidgets.dll!wxEntryStart() + 0x5 bytes
    c:\wxwidgets-3.0.5\src\common\init.cpp (542): php_wxwidgets.dll!wxInitialize() + 0xF bytes
    c:\wxwidgets-3.0.5\src\common\init.cpp (530): php_wxwidgets.dll!wxInitialize()
    c:\build\phpdev\vc14\x64\php7\ext\php_wxwidgets\wxphp\wxwidgets.cpp (1501): php_wxwidgets.dll!zm_activate_php_wxWidgets()
    c:\build\phpdev\vc14\x64\php7\zend\zend_api.c (2539): php7ts_debug.dll!zend_activate_modules() + 0x21 bytes
    c:\build\phpdev\vc14\x64\php7\main\main.c (1699): php7ts_debug.dll!php_request_startup()
    c:\build\phpdev\vc14\x64\php7\sapi\cgi\cgi_main.c (2545): php-cgi.exe!main() + 0x6 bytes
    f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl (65): php-cgi.exe!invoke_main()
    f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl (253): php-cgi.exe!__scrt_common_main_seh() + 0x5 bytes
    f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl (296): php-cgi.exe!__scrt_common_main()
    f:\dd\vctools\crt\vcstartup\src\startup\exe_main.cpp (17): php-cgi.exe!mainCRTStartup()
    kernel32.dll!BaseThreadInitThunk() + 0xD bytes
    ntdll.dll!RtlUserThreadStart() + 0x1D bytes
    Data:
    00 9E 3D E4 FE 07 00 00 00 00 00 00 00 00 00 00 ..=..... ........
    F0 68 0C 0A 00 00 00 00 E0 B8 BC 06 00 00 00 00 .h...... ........
    CD CD CD CD CD CD CD CD 13 00 00 00 00 00 00 00 ........ ........
    17 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........
    CD CD CD CD CD CD CD CD D0 6A 0C 0A 00 00 00 00 ........ .j......
    62 00 6D 00 70 00 00 00 CD CD CD CD CD CD CD CD b.m.p... ........
    03 00 00 00 00 00 00 00 07 00 00 00 00 00 00 00 ........ ........
    00 00 00 00 00 00 00 00 CD CD CD CD CD CD CD CD ........ ........
    E0 69 0C 0A 00 00 00 00 00 00 00 00 00 00 00 00 .i...... ........
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........
    20 6B 0C 0A 00 00 00 00 00 AE 10 0A 00 00 00 00 .k...... ........
    CD CD CD CD CD CD CD CD 0B 00 00 00 00 00 00 00 ........ ........
    0F 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........
    CD CD CD CD CD CD CD CD 01 00 00 00 CD CD CD CD ........ ........

    ---------- Block 190 at 0x00000000042F3830: 112 bytes ----------
    Leak Hash: 0x97BAD2FC, Count: 1, Total 112 bytes
    Call Stack (TID 1088):
    f:\dd\vctools\crt\vcstartup\src\heap\new_scalar.cpp (19): php_wxwidgets.dll!operator new() + 0xA bytes
    c:\wxwidgets-3.0.5\src\common\any.cpp (131): php_wxwidgets.dll!wxPreRegisterAnyToVariant() + 0xA bytes
    c:\wxwidgets-3.0.5\src\common\variant.cpp (201): php_wxwidgets.dll!wxAnyToVariantRegistration::wxAnyToVariantRegistration()
    c:\wxwidgets-3.0.5\include\wx\variant.h (430): php_wxwidgets.dll!wxAnyToVariantRegistrationImpl::wxAnyToVariantRegistrationImpl()
    c:\wxwidgets-3.0.5\src\common\variant.cpp (441): php_wxwidgets.dll!dynamic initializer for 'gs_wxVariantDoubleDataAnyToVariantRegistration''() + 0x17 bytes d:\th\minkernel\crts\ucrt\src\appcrt\startup\initterm.cpp (22): ucrtbased.dll!_initterm() f:\dd\vctools\crt\vcstartup\src\startup\dll_dllmain.cpp (67): php_wxwidgets.dll!dllmain_crt_process_attach() f:\dd\vctools\crt\vcstartup\src\startup\dll_dllmain.cpp (133): php_wxwidgets.dll!dllmain_crt_dispatch() + 0xF bytes f:\dd\vctools\crt\vcstartup\src\startup\dll_dllmain.cpp (190): php_wxwidgets.dll!dllmain_dispatch() + 0x13 bytes f:\dd\vctools\crt\vcstartup\src\startup\dll_dllmain.cpp (249): php_wxwidgets.dll!_DllMainCRTStartup() ntdll.dll!LdrpRunInitializeRoutines() + 0x1FE bytes ntdll.dll!LdrpLoadDll() + 0x594 bytes ntdll.dll!LdrLoadDll() + 0xED bytes KERNELBASE.dll!LoadLibraryExW() + 0x2A3 bytes KERNELBASE.dll!LoadLibraryExA() + 0x51 bytes kernel32.dll!LoadLibraryA() + 0x34 bytes c:\build\phpdev\vc14\x64\php7\ext\standard\dl.c (132): php7ts_debug.dll!php_load_extension() + 0xB bytes c:\build\phpdev\vc14\x64\php7\main\php_ini.c (348): php7ts_debug.dll!php_load_php_extension_cb() c:\build\phpdev\vc14\x64\php7\zend\zend_llist.c (185): php7ts_debug.dll!zend_llist_apply() c:\build\phpdev\vc14\x64\php7\main\php_ini.c (743): php7ts_debug.dll!php_ini_register_extensions() c:\build\phpdev\vc14\x64\php7\main\main.c (2300): php7ts_debug.dll!php_module_startup() c:\build\phpdev\vc14\x64\php7\sapi\cgi\cgi_main.c (975): php-cgi.exe!php_cgi_startup() + 0x18 bytes c:\build\phpdev\vc14\x64\php7\sapi\cgi\cgi_main.c (1981): php-cgi.exe!main() + 0xD bytes f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl (65): php-cgi.exe!invoke_main() f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl (253): php-cgi.exe!__scrt_common_main_seh() + 0x5 bytes f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl (296): php-cgi.exe!__scrt_common_main() f:\dd\vctools\crt\vcstartup\src\startup\exe_main.cpp (17): php-cgi.exe!mainCRTStartup() kernel32.dll!BaseThreadInitThunk() + 0xD bytes ntdll.dll!RtlUserThreadStart() + 0x1D bytes Data: 00 00 80 3F CD CD CD CD A0 09 58 06 00 00 00 00 ...?.... ..X..... D0 7F 39 04 00 00 00 00 00 00 00 00 00 00 00 00 ..9..... ........ 40 0A 58 06 00 00 00 00 E0 E2 3A 04 00 00 00 00 @.X..... ..:..... 60 E3 3A 04 00 00 00 00 60 E3 3A 04 00 00 00 00 .:..... `.:.....
    07 00 00 00 00 00 00 00 08 00 00 00 00 00 00 00 ........ ........
    90 0A 58 06 00 00 00 00 40 54 5C 06 00 00 00 00 ..X..... @t.....
    F0 54 5C 06 00 00 00 00 20 55 5C 06 00 00 00 00 .T..... .U.....

    ---------- Block 191 at 0x0000000004397FD0: 32 bytes ----------
    Leak Hash: 0x623ED270, Count: 1, Total 32 bytes
    Call Stack (TID 1088):
    Data:
    D0 7F 39 04 00 00 00 00 D0 7F 39 04 00 00 00 00 ..9..... ..9.....
    CD CD CD CD CD CD CD CD CD CD CD CD CD CD CD CD ........ ........

    ---------- Block 194 at 0x00000000043AE2E0: 128 bytes ----------
    Leak Hash: 0x619F9E48, Count: 1, Total 128 bytes
    Call Stack (TID 1088):
    c:\program files (x86)\microsoft visual studio 14.0\vc\include\xmemory0 (977): php_wxwidgets.dll!std::_Wrap_alloc<std::_Wrap_alloc<std::allocator<std::_List_unchecked_iterator<std::_List_val<std::_List_simple_types<std::pair<wxAnyValueType * __ptr64 const,wxVariantData * __ptr64 (__cdecl*)(wxAny const & __ptr64)> > > > > > >::allocate()
    c:\program files (x86)\microsoft visual studio 14.0\vc\include\vector (1602): php_wxwidgets.dll!std::vector<std::_List_unchecked_iterator<std::_List_val<std::_List_simple_types<std::pair<wxAnyValueType * __ptr64 const,wxVariantData * __ptr64 (__cdecl*)(wxAny const & __ptr64)> > > >,std::_Wrap_alloc<std::allocator<std::List_unchecked_iterator<std::() + 0x1D bytes
    c:\program files (x86)\microsoft visual studio 14.0\vc\include\vector (1039): php_wxwidgets.dll!std::vector<std::_List_unchecked_iterator<std::_List_val<std::_List_simple_types<std::pair<wxAnyValueType * __ptr64 const,wxVariantData * __ptr64 (__cdecl*)(wxAny const & __ptr64)> > > >,std::_Wrap_alloc<std::allocator<std::List_unchecked_iterator<std::()
    c:\program files (x86)\microsoft visual studio 14.0\vc\include\xhash (865): php_wxwidgets.dll!std::_Hash<std::_Umap_traits<wxAnyValueType * __ptr64,wxVariantData * __ptr64 (__cdecl*)(wxAny const & __ptr64),std::_Uhash_compare<wxAnyValueType * __ptr64,wxPointerHash,wxPointerEqual>,std::allocator<std::pair<wxAnyValueType * __ptr64 const,wxVariantDat()
    c:\program files (x86)\microsoft visual studio 14.0\vc\include\xhash (202): php_wxwidgets.dll!std::_Hash<std::_Umap_traits<wxAnyValueType * __ptr64,wxVariantData * __ptr64 (__cdecl*)(wxAny const & __ptr64),std::_Uhash_compare<wxAnyValueType * __ptr64,wxPointerHash,wxPointerEqual>,std::allocator<std::pair<wxAnyValueType * __ptr64 const,wxVariantDat() + 0xF bytes
    c:\program files (x86)\microsoft visual studio 14.0\vc\include\unordered_map (119): php_wxwidgets.dll!std::unordered_map<wxAnyValueType * __ptr64,wxVariantData * __ptr64 (__cdecl*)(wxAny const & __ptr64),wxPointerHash,wxPointerEqual,std::allocator<std::pair<wxAnyValueType * __ptr64 const,wxVariantData * __ptr64 (__cdecl*)(wxAny const & __ptr64)> > >::unor()
    c:\wxwidgets-3.0.5\src\common\any.cpp (54): php_wxwidgets.dll!wxAnyValueTypeGlobals::wxAnyValueTypeGlobals() + 0xD bytes
    c:\wxwidgets-3.0.5\src\common\any.cpp (131): php_wxwidgets.dll!wxPreRegisterAnyToVariant() + 0x21 bytes
    c:\wxwidgets-3.0.5\src\common\variant.cpp (201): php_wxwidgets.dll!wxAnyToVariantRegistration::wxAnyToVariantRegistration()
    c:\wxwidgets-3.0.5\include\wx\variant.h (430): php_wxwidgets.dll!wxAnyToVariantRegistrationImpl::wxAnyToVariantRegistrationImpl()
    c:\wxwidgets-3.0.5\src\common\variant.cpp (441): php_wxwidgets.dll!`dynamic initializer for 'gs_wxVariantDoubleDataAnyToVariantRegistration''() + 0x17 bytes
    d:\th\minkernel\crts\ucrt\src\appcrt\startup\initterm.cpp (22): ucrtbased.dll!_initterm()
    f:\dd\vctools\crt\vcstartup\src\startup\dll_dllmain.cpp (67): php_wxwidgets.dll!dllmain_crt_process_attach()
    f:\dd\vctools\crt\vcstartup\src\startup\dll_dllmain.cpp (133): php_wxwidgets.dll!dllmain_crt_dispatch() + 0xF bytes
    f:\dd\vctools\crt\vcstartup\src\startup\dll_dllmain.cpp (190): php_wxwidgets.dll!dllmain_dispatch() + 0x13 bytes
    f:\dd\vctools\crt\vcstartup\src\startup\dll_dllmain.cpp (249): php_wxwidgets.dll!_DllMainCRTStartup()
    ntdll.dll!LdrpRunInitializeRoutines() + 0x1FE bytes
    ntdll.dll!LdrpLoadDll() + 0x594 bytes
    ntdll.dll!LdrLoadDll() + 0xED bytes
    KERNELBASE.dll!LoadLibraryExW() + 0x2A3 bytes
    KERNELBASE.dll!LoadLibraryExA() + 0x51 bytes
    kernel32.dll!LoadLibraryA() + 0x34 bytes
    c:\build\phpdev\vc14\x64\php7\ext\standard\dl.c (132): php7ts_debug.dll!php_load_extension() + 0xB bytes
    c:\build\phpdev\vc14\x64\php7\main\php_ini.c (348): php7ts_debug.dll!php_load_php_extension_cb()
    c:\build\phpdev\vc14\x64\php7\zend\zend_llist.c (185): php7ts_debug.dll!zend_llist_apply()
    c:\build\phpdev\vc14\x64\php7\main\php_ini.c (743): php7ts_debug.dll!php_ini_register_extensions()
    c:\build\phpdev\vc14\x64\php7\main\main.c (2300): php7ts_debug.dll!php_module_startup()
    c:\build\phpdev\vc14\x64\php7\sapi\cgi\cgi_main.c (975): php-cgi.exe!php_cgi_startup() + 0x18 bytes
    c:\build\phpdev\vc14\x64\php7\sapi\cgi\cgi_main.c (1981): php-cgi.exe!main() + 0xD bytes
    f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl (65): php-cgi.exe!invoke_main()
    f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl (253): php-cgi.exe!__scrt_common_main_seh() + 0x5 bytes
    f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl (296): php-cgi.exe!__scrt_common_main()
    f:\dd\vctools\crt\vcstartup\src\startup\exe_main.cpp (17): php-cgi.exe!mainCRTStartup()
    kernel32.dll!BaseThreadInitThunk() + 0xD bytes
    ntdll.dll!RtlUserThreadStart() + 0x1D bytes
    Data:
    D0 7F 39 04 00 00 00 00 D0 7F 39 04 00 00 00 00 ..9..... ..9.....
    D0 7F 39 04 00 00 00 00 D0 7F 39 04 00 00 00 00 ..9..... ..9.....
    D0 7F 39 04 00 00 00 00 D0 7F 39 04 00 00 00 00 ..9..... ..9.....
    D0 7F 39 04 00 00 00 00 D0 7F 39 04 00 00 00 00 ..9..... ..9.....
    D0 7F 39 04 00 00 00 00 D0 7F 39 04 00 00 00 00 ..9..... ..9.....
    D0 7F 39 04 00 00 00 00 D0 7F 39 04 00 00 00 00 ..9..... ..9.....
    D0 7F 39 04 00 00 00 00 D0 7F 39 04 00 00 00 00 ..9..... ..9.....
    D0 7F 39 04 00 00 00 00 D0 7F 39 04 00 00 00 00 ..9..... ..9.....

    ---------- Block 192 at 0x00000000065809A0: 16 bytes ----------
    Leak Hash: 0x985CE717, Count: 1, Total 16 bytes
    Call Stack (TID 1088):
    c:\program files (x86)\microsoft visual studio 14.0\vc\include\xmemory0 (977): php_wxwidgets.dll!std::_Wrap_alloc<std::allocatorstd::_Container_proxy >::allocate()
    c:\program files (x86)\microsoft visual studio 14.0\vc\include\list (682): php_wxwidgets.dll!std::_List_alloc<std::_List_base_types<std::pair<wxAnyValueType * __ptr64 const,wxVariantData * __ptr64 (__cdecl*)(wxAny const & __ptr64)>,std::allocator<std::pair<wxAnyValueType * __ptr64 const,wxVariantData * __ptr64 (__cdecl*)(wxAny const & __ptr64)> >() + 0xF bytes
    c:\program files (x86)\microsoft visual studio 14.0\vc\include\list (651): php_wxwidgets.dll!std::_List_alloc<std::_List_base_types<std::pair<wxAnyValueType * __ptr64 const,wxVariantData * __ptr64 (__cdecl*)(wxAny const & __ptr64)>,std::allocator<std::pair<wxAnyValueType * __ptr64 const,wxVariantData * __ptr64 (__cdecl*)(wxAny const & __ptr64)> >() + 0xA bytes
    c:\program files (x86)\microsoft visual studio 14.0\vc\include\list (826): php_wxwidgets.dll!std::_List_buy<std::pair<wxAnyValueType * __ptr64 const,wxVariantData * __ptr64 (__cdecl*)(wxAny const & __ptr64)>,std::allocator<std::pair<wxAnyValueType * __ptr64 const,wxVariantData * __ptr64 (__cdecl*)(wxAny const & __ptr64)> > >::_List_buy<std::pair<()
    c:\program files (x86)\microsoft visual studio 14.0\vc\include\list (899): php_wxwidgets.dll!std::list<std::pair<wxAnyValueType * __ptr64 const,wxVariantData * __ptr64 (__cdecl*)(wxAny const & __ptr64)>,std::allocator<std::pair<wxAnyValueType * __ptr64 const,wxVariantData * __ptr64 (__cdecl*)(wxAny const & __ptr64)> > >::list<std::pair<wxAnyValue()
    c:\program files (x86)\microsoft visual studio 14.0\vc\include\xhash (197): php_wxwidgets.dll!std::_Hash<std::_Umap_traits<wxAnyValueType * __ptr64,wxVariantData * __ptr64 (__cdecl*)(wxAny const & __ptr64),std::_Uhash_compare<wxAnyValueType * __ptr64,wxPointerHash,wxPointerEqual>,std::allocator<std::pair<wxAnyValueType * __ptr64 const,wxVariantDat() + 0x16 bytes
    c:\program files (x86)\microsoft visual studio 14.0\vc\include\unordered_map (119): php_wxwidgets.dll!std::unordered_map<wxAnyValueType * __ptr64,wxVariantData * __ptr64 (__cdecl*)(wxAny const & __ptr64),wxPointerHash,wxPointerEqual,std::allocator<std::pair<wxAnyValueType * __ptr64 const,wxVariantData * __ptr64 (__cdecl*)(wxAny const & __ptr64)> > >::unor()
    c:\wxwidgets-3.0.5\src\common\any.cpp (54): php_wxwidgets.dll!wxAnyValueTypeGlobals::wxAnyValueTypeGlobals() + 0xD bytes
    c:\wxwidgets-3.0.5\src\common\any.cpp (131): php_wxwidgets.dll!wxPreRegisterAnyToVariant() + 0x21 bytes
    c:\wxwidgets-3.0.5\src\common\variant.cpp (201): php_wxwidgets.dll!wxAnyToVariantRegistration::wxAnyToVariantRegistration()
    c:\wxwidgets-3.0.5\include\wx\variant.h (430): php_wxwidgets.dll!wxAnyToVariantRegistrationImpl::wxAnyToVariantRegistrationImpl()
    c:\wxwidgets-3.0.5\src\common\variant.cpp (441): php_wxwidgets.dll!`dynamic initializer for 'gs_wxVariantDoubleDataAnyToVariantRegistration''() + 0x17 bytes
    d:\th\minkernel\crts\ucrt\src\appcrt\startup\initterm.cpp (22): ucrtbased.dll!_initterm()
    f:\dd\vctools\crt\vcstartup\src\startup\dll_dllmain.cpp (67): php_wxwidgets.dll!dllmain_crt_process_attach()
    f:\dd\vctools\crt\vcstartup\src\startup\dll_dllmain.cpp (133): php_wxwidgets.dll!dllmain_crt_dispatch() + 0xF bytes
    f:\dd\vctools\crt\vcstartup\src\startup\dll_dllmain.cpp (190): php_wxwidgets.dll!dllmain_dispatch() + 0x13 bytes
    f:\dd\vctools\crt\vcstartup\src\startup\dll_dllmain.cpp (249): php_wxwidgets.dll!_DllMainCRTStartup()
    ntdll.dll!LdrpRunInitializeRoutines() + 0x1FE bytes
    ntdll.dll!LdrpLoadDll() + 0x594 bytes
    ntdll.dll!LdrLoadDll() + 0xED bytes
    KERNELBASE.dll!LoadLibraryExW() + 0x2A3 bytes
    KERNELBASE.dll!LoadLibraryExA() + 0x51 bytes
    kernel32.dll!LoadLibraryA() + 0x34 bytes
    c:\build\phpdev\vc14\x64\php7\ext\standard\dl.c (132): php7ts_debug.dll!php_load_extension() + 0xB bytes
    c:\build\phpdev\vc14\x64\php7\main\php_ini.c (348): php7ts_debug.dll!php_load_php_extension_cb()
    c:\build\phpdev\vc14\x64\php7\zend\zend_llist.c (185): php7ts_debug.dll!zend_llist_apply()
    c:\build\phpdev\vc14\x64\php7\main\php_ini.c (743): php7ts_debug.dll!php_ini_register_extensions()
    c:\build\phpdev\vc14\x64\php7\main\main.c (2300): php7ts_debug.dll!php_module_startup()
    c:\build\phpdev\vc14\x64\php7\sapi\cgi\cgi_main.c (975): php-cgi.exe!php_cgi_startup() + 0x18 bytes
    c:\build\phpdev\vc14\x64\php7\sapi\cgi\cgi_main.c (1981): php-cgi.exe!main() + 0xD bytes
    f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl (65): php-cgi.exe!invoke_main()
    f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl (253): php-cgi.exe!__scrt_common_main_seh() + 0x5 bytes
    f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl (296): php-cgi.exe!__scrt_common_main()
    f:\dd\vctools\crt\vcstartup\src\startup\exe_main.cpp (17): php-cgi.exe!mainCRTStartup()
    kernel32.dll!BaseThreadInitThunk() + 0xD bytes
    ntdll.dll!RtlUserThreadStart() + 0x1D bytes
    Data:
    38 38 2F 04 00 00 00 00 00 00 00 00 00 00 00 00 88/..... ........

    ---------- Block 193 at 0x0000000006580A40: 16 bytes ----------
    Leak Hash: 0x9A0F1ABB, Count: 1, Total 16 bytes
    Call Stack (TID 1088):
    c:\program files (x86)\microsoft visual studio 14.0\vc\include\xmemory0 (977): php_wxwidgets.dll!std::_Wrap_alloc<std::_Wrap_alloc<std::allocatorstd::_Container_proxy > >::allocate()
    c:\program files (x86)\microsoft visual studio 14.0\vc\include\vector (580): php_wxwidgets.dll!std::_Vector_alloc<std::_Vec_base_types<std::_List_unchecked_iterator<std::_List_val<std::_List_simple_types<std::pair<wxAnyValueType * __ptr64 const,wxVariantData * __ptr64 (__cdecl*)(wxAny const & __ptr64)> > > >,std::_Wrap_alloc<std::allocator<std::_Li() + 0xF bytes
    c:\program files (x86)\microsoft visual studio 14.0\vc\include\vector (554): php_wxwidgets.dll!std::_Vector_alloc<std::_Vec_base_types<std::_List_unchecked_iterator<std::_List_val<std::_List_simple_types<std::pair<wxAnyValueType * __ptr64 const,wxVariantData * __ptr64 (__cdecl*)(wxAny const & __ptr64)> > > >,std::_Wrap_alloc<std::allocator<std::_Li() + 0xA bytes
    c:\program files (x86)\microsoft visual studio 14.0\vc\include\vector (711): php_wxwidgets.dll!std::vector<std::_List_unchecked_iterator<std::_List_val<std::_List_simple_types<std::pair<wxAnyValueType * __ptr64 const,wxVariantData * __ptr64 (__cdecl*)(wxAny const & __ptr64)> > > >,std::_Wrap_alloc<std::allocator<std::List_unchecked_iterator<std::() + 0xF bytes
    c:\program files (x86)\microsoft visual studio 14.0\vc\include\xhash (198): php_wxwidgets.dll!std::_Hash<std::_Umap_traits<wxAnyValueType * __ptr64,wxVariantData * __ptr64 (__cdecl*)(wxAny const & __ptr64),std::_Uhash_compare<wxAnyValueType * __ptr64,wxPointerHash,wxPointerEqual>,std::allocator<std::pair<wxAnyValueType * __ptr64 const,wxVariantDat() + 0x25 bytes
    c:\program files (x86)\microsoft visual studio 14.0\vc\include\unordered_map (119): php_wxwidgets.dll!std::unordered_map<wxAnyValueType * __ptr64,wxVariantData * __ptr64 (__cdecl*)(wxAny const & __ptr64),wxPointerHash,wxPointerEqual,std::allocator<std::pair<wxAnyValueType * __ptr64 const,wxVariantData * __ptr64 (__cdecl*)(wxAny const & __ptr64)> > >::unor()
    c:\wxwidgets-3.0.5\src\common\any.cpp (54): php_wxwidgets.dll!wxAnyValueTypeGlobals::wxAnyValueTypeGlobals() + 0xD bytes
    c:\wxwidgets-3.0.5\src\common\any.cpp (131): php_wxwidgets.dll!wxPreRegisterAnyToVariant() + 0x21 bytes
    c:\wxwidgets-3.0.5\src\common\variant.cpp (201): php_wxwidgets.dll!wxAnyToVariantRegistration::wxAnyToVariantRegistration()
    c:\wxwidgets-3.0.5\include\wx\variant.h (430): php_wxwidgets.dll!wxAnyToVariantRegistrationImpl::wxAnyToVariantRegistrationImpl()
    c:\wxwidgets-3.0.5\src\common\variant.cpp (441): php_wxwidgets.dll!`dynamic initializer for 'gs_wxVariantDoubleDataAnyToVariantRegistration''() + 0x17 bytes
    d:\th\minkernel\crts\ucrt\src\appcrt\startup\initterm.cpp (22): ucrtbased.dll!_initterm()
    f:\dd\vctools\crt\vcstartup\src\startup\dll_dllmain.cpp (67): php_wxwidgets.dll!dllmain_crt_process_attach()
    f:\dd\vctools\crt\vcstartup\src\startup\dll_dllmain.cpp (133): php_wxwidgets.dll!dllmain_crt_dispatch() + 0xF bytes
    f:\dd\vctools\crt\vcstartup\src\startup\dll_dllmain.cpp (190): php_wxwidgets.dll!dllmain_dispatch() + 0x13 bytes
    f:\dd\vctools\crt\vcstartup\src\startup\dll_dllmain.cpp (249): php_wxwidgets.dll!_DllMainCRTStartup()
    ntdll.dll!LdrpRunInitializeRoutines() + 0x1FE bytes
    ntdll.dll!LdrpLoadDll() + 0x594 bytes
    ntdll.dll!LdrLoadDll() + 0xED bytes
    KERNELBASE.dll!LoadLibraryExW() + 0x2A3 bytes
    KERNELBASE.dll!LoadLibraryExA() + 0x51 bytes
    kernel32.dll!LoadLibraryA() + 0x34 bytes
    c:\build\phpdev\vc14\x64\php7\ext\standard\dl.c (132): php7ts_debug.dll!php_load_extension() + 0xB bytes
    c:\build\phpdev\vc14\x64\php7\main\php_ini.c (348): php7ts_debug.dll!php_load_php_extension_cb()
    c:\build\phpdev\vc14\x64\php7\zend\zend_llist.c (185): php7ts_debug.dll!zend_llist_apply()
    c:\build\phpdev\vc14\x64\php7\main\php_ini.c (743): php7ts_debug.dll!php_ini_register_extensions()
    c:\build\phpdev\vc14\x64\php7\main\main.c (2300): php7ts_debug.dll!php_module_startup()
    c:\build\phpdev\vc14\x64\php7\sapi\cgi\cgi_main.c (975): php-cgi.exe!php_cgi_startup() + 0x18 bytes
    c:\build\phpdev\vc14\x64\php7\sapi\cgi\cgi_main.c (1981): php-cgi.exe!main() + 0xD bytes
    f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl (65): php-cgi.exe!invoke_main()
    f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl (253): php-cgi.exe!__scrt_common_main_seh() + 0x5 bytes
    f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl (296): php-cgi.exe!__scrt_common_main()
    f:\dd\vctools\crt\vcstartup\src\startup\exe_main.cpp (17): php-cgi.exe!mainCRTStartup()
    kernel32.dll!BaseThreadInitThunk() + 0xD bytes
    ntdll.dll!RtlUserThreadStart() + 0x1D bytes
    Data:
    50 38 2F 04 00 00 00 00 00 00 00 00 00 00 00 00 P8/..... ........

    wxwidgets.cpp:
    line 1497 wxInitialize();

        zval z_wxNullBitmap;
    	///ZVAL_NULL(&z_wxNullBitmap);
    

    line 1501 object_init_ex(&z_wxNullBitmap, php_wxBitmap_entry);
    Z_wxBitmap_P(&z_wxNullBitmap)->native_object = (wxBitmap_php*) &wxNullBitmap;
    wxPHP_REGISTER_OBJECT_CONSTANT("wxNullBitmap", z_wxNullBitmap, CONST_CS | CONST_PERSISTENT);

    	zval_ptr_dtor(&z_wxNullBitmap);
    

    I comment all other constants

  3. jgmdev commented on Sep 30, 2020

    @jgmdev
    Member

    I build the master version with php 7.1.33, and comment all other class in PHP_RINIT_FUNCTION(php_wxWidgets)
    except the zval z_wxNullBitmap;

    Why did you commented all the classes and only leave z_wxNullBitmap, to find a runtime issue?

  4. LordOfTheRats commented on Oct 2, 2020

    @LordOfTheRats
    Contributor

    Hi jank9201,

    could you post the failing PHP code? I think this might just be a mismatch between documented wxWidgets API and actual wxPHP API. There are some slight differences / not all overloaded methods are available.

    We have indeed still some memory leaks in the PHP 7 version that I have been hunting for quite a while, but with no success.

  5. jank9201 commented on Oct 9, 2020

    @jank9201
    Author

    _**>

    I build the master version with php 7.1.33, and comment all other class in PHP_RINIT_FUNCTION(php_wxWidgets)
    except the zval z_wxNullBitmap;

    Why did you commented all the classes and only leave z_wxNullBitmap, to find a runtime issue?**_

    I build the current wxPHP dll with php 7.1.33, when I ran the example, in Rapid PHP 2018, it trigger a crush, so I coded with vld and comment all other class in PHP_RINIT_FUNCTION(php_wxWidgets), only leave z_wxNullBitmap to check what cause the crash, I now still have not found it, It seems the variable somewhere did not free the memory.

  6. jank9201 commented on Oct 9, 2020

    @jank9201
    Author

    Hi jank9201,

    could you post the failing PHP code? I think this might just be a mismatch between documented wxWidgets API and actual wxPHP API. There are some slight differences / not all overloaded methods are available.

    We have indeed still some memory leaks in the PHP 7 version that I have been hunting for quite a while, but with no success.

    Hi, LordOfTheRats
    this is the code I commented
    PHP_RINIT_FUNCTION(php_wxWidgets)
    {
    static int objects_intialized = 0;

    /**
     * Space reserved for the initialization of global object
     * constants, since the php engine doesnt initializes the object
     * store prior to calling extensions MINIT function.
     *
     * Note:
     *
     * Predefined fonts, pens brushes, colors and cursos are  initilized
     * by 'wxStockGDI::instance().Get*(item)' functions and it needs
     * wxInitilize call in order to work (learned this the hard way)
     */
    
    if(objects_intialized < 1)
    {
    
        wxInitialize();
    	
        zval z_wxNullBitmap;		
        object_init_ex(&z_wxNullBitmap, php_wxBitmap_entry);
    	Z_wxBitmap_P(&z_wxNullBitmap)->native_object = (wxBitmap_php*) &wxNullBitmap;		
        wxPHP_REGISTER_OBJECT_CONSTANT("wxNullBitmap", z_wxNullBitmap, CONST_CS | CONST_PERSISTENT);
    	
    	zval_ptr_dtor(&z_wxNullBitmap);
    
    	/*
        zval z_wxNullFont;
        object_init_ex(&z_wxNullFont, php_wxFont_entry);
        Z_wxFont_P(&z_wxNullFont)->native_object = (wxFont_php*) &wxNullFont;
        wxPHP_REGISTER_OBJECT_CONSTANT("wxNullFont", z_wxNullFont, CONST_CS | CONST_PERSISTENT);
          ....
        zval z_wxDefaultVideoMode;
        object_init_ex(&z_wxDefaultVideoMode, php_wxVideoMode_entry);
        Z_wxVideoMode_P(&z_wxDefaultVideoMode)->native_object = (wxVideoMode_php*) &wxDefaultVideoMode;
        wxPHP_REGISTER_OBJECT_CONSTANT("wxDefaultVideoMode", z_wxDefaultVideoMode, CONST_CS | CONST_PERSISTENT);
    	
    	*/
    }
    
    return SUCCESS;
    

    }

    if I comment the code "ZVAL_COPY(&c.value, &object); " in void wxphp_register_object_constant(const char *name, zval object, int flags, int module_number), It did not crush when load php engine, so I thought the memory leakage may be relate to the the initialization of the constand register.

  7. LordOfTheRats commented on Oct 14, 2020

    @LordOfTheRats
    Contributor

    Hi,

    at least some of the memory leaks are quite normal in some situations. The registered constants are freed when the PHP engine shuts down, but this won't happen if the engine crashes for any reason, so vld or valgrind would see this as a memory leak.

    I think this internal zval's can't be arrays, objects or resources is your actual problem, possibly unrelated to the mem leaks. Which example are you trying to run?

  8. jank9201 commented on Oct 16, 2020

    @jank9201
    Author

    Hi,

    at least some of the memory leaks are quite normal in some situations. The registered constants are freed when the PHP engine shuts down, but this won't happen if the engine crashes for any reason, so vld or valgrind would see this as a memory leak.

    I think this internal zval's can't be arrays, objects or resources is your actual problem, possibly unrelated to the mem leaks. Which example are you trying to run?

    Hi, LordOfTheRats
    If the php engine load the wxphp dll, when the window close or php engine shut down, I got a CGI/FastCGI crush. for example
    choicelistbox.php, styledtextctrl.php, even the following code

    `< !DOCTYPE html>

    < html>

    < head>
    < title>Hello!</title>
    < /head>

    < body>
    < ?php
    echo("Hello, World!");
    ?>
    < /body>
    < /html>`

    ?
    so I think, when the php engine shut down, some allocated memory need to be released.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions