├── .gitignore ├── Cargo.lock ├── Cargo.toml ├── Makefile ├── README.md ├── build.rs ├── src ├── lib.rs ├── rust_a_star.php └── zend_module.rs └── valgrind.md /.gitignore: -------------------------------------------------------------------------------- 1 | target 2 | src/zend_module_size.rs -------------------------------------------------------------------------------- /Cargo.lock: -------------------------------------------------------------------------------- 1 | [root] 2 | name = "rust_a_star" 3 | version = "0.0.1" 4 | dependencies = [ 5 | "lazy_static 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", 6 | ] 7 | 8 | [[package]] 9 | name = "lazy_static" 10 | version = "0.1.16" 11 | source = "registry+https://github.com/rust-lang/crates.io-index" 12 | 13 | [metadata] 14 | "checksum lazy_static 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "cf186d1a8aa5f5bee5fd662bc9c1b949e0259e1bcc379d1f006847b0080c7417" 15 | -------------------------------------------------------------------------------- /Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "rust_a_star" 3 | version = "0.0.1" 4 | authors = ["Jared McFarland "] 5 | build = "build.rs" 6 | 7 | [lib] 8 | name = "rust_a_star" 9 | crate-type = ["dylib"] 10 | 11 | [dependencies] 12 | lazy_static = "0.1.*" 13 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | build: 2 | cargo build 3 | cp target/debug/librust_a_star.dylib /Users/tim/proj_/php/php-src/../php-out/lib/php/extensions/debug-non-zts-20160303/librust_a_star.dylib 4 | 5 | run: build 6 | ~/proj_/php/php-out/bin/php src/rust_a_star.php 7 | 8 | debug: build 9 | gdb run -tui --args ~/proj_/php/php-out/bin/php src/rust_a_star.php 10 | 11 | valgrind: 12 | valgrind --leak-check=full ~/proj_/php/php-out/bin/php src/rust_a_star.php -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # PHP 7 Extension without any C Code in pure Rust 2 | forked from https://github.com/jaredonline/rust-php 3 | 4 | you can build this php extension using the current rust nightly. -------------------------------------------------------------------------------- /build.rs: -------------------------------------------------------------------------------- 1 | #![feature(libc)] 2 | extern crate libc; 3 | use std::io::prelude::*; 4 | use std::fs::File; 5 | 6 | include!("src/zend_module.rs"); 7 | 8 | fn main() { 9 | 10 | let mut f = File::create("src/zend_module_size.rs").expect("could not open zend_module_size.rs"); 11 | f.write_all( 12 | &format!("pub const ZEND_MODULE_SIZE : i16 = {};", std::mem::size_of::()).as_bytes() 13 | ).expect("could not write size file"); 14 | } -------------------------------------------------------------------------------- /src/lib.rs: -------------------------------------------------------------------------------- 1 | #![feature(libc)] 2 | #[macro_use] extern crate lazy_static; 3 | 4 | extern crate libc; 5 | mod zend_module; 6 | mod zend_module_size; 7 | use zend_module::*; 8 | use libc::{c_void, c_int, c_char, c_uchar, c_uint, c_short}; 9 | 10 | //extern { 11 | //fn zend_parse_parameters(num_args: c_int, type_spce: *const c_char, ...); 12 | //} 13 | 14 | #[no_mangle] 15 | pub extern "C" fn zif_confirm_rust_a_star_compiled(_: c_int, _: *mut zval, _: *mut *mut zval, _: *mut zval, _: c_int) { 16 | // panic!("yay"); 17 | // println!("yes!"); 18 | } 19 | 20 | #[no_mangle] 21 | pub extern "C" fn zm_generic_rust_a_star(_: c_int, _: c_int) -> c_int { 22 | //panic!("yay"); 23 | 1 24 | } 25 | 26 | #[no_mangle] 27 | pub extern "C" fn zm_info_rust_a_star(_: *const zend_module_entry) { } 28 | 29 | lazy_static! { 30 | static ref ZEND_ENTRY_SIZE: c_short = ::std::mem::size_of::() as c_short; 31 | } 32 | 33 | #[no_mangle] 34 | pub extern "C" fn get_module(_: c_void) -> *const zend_module_entry { 35 | use std::mem; 36 | 37 | struct Foo; 38 | 39 | static rust_a_star_functions: [zend_function_entry;2] = [ 40 | zend_function_entry { 41 | fname: b"confirm_rust_a_star_compiled\0" as *const [u8] as *const i8, 42 | handler: Some(zif_confirm_rust_a_star_compiled), 43 | arg_info: 0 as *const _zend_arg_info, 44 | num_args: 0, 45 | flags: 0 46 | }, 47 | zend_function_entry { 48 | fname: 0 as *const c_char, 49 | handler: None, 50 | arg_info: 0 as *const _zend_arg_info, 51 | num_args: 0, 52 | flags: 0 53 | } 54 | ]; 55 | 56 | let size : c_short = *ZEND_ENTRY_SIZE as c_short; 57 | 58 | static module_entry: &'static zend_module_entry = &zend_module_entry { 59 | size: zend_module_size::ZEND_MODULE_SIZE, 60 | zend_api: 20160303, 61 | zend_debug: 0, 62 | zts: 0, 63 | ini_entry: 0 as *const _zend_ini_entry, 64 | deps: 0 as *const _zend_module_dep, 65 | name: b"rust_a_star\0" as *const [u8] as *const i8, 66 | functions: &rust_a_star_functions as *const [zend_function_entry] as *const zend_function_entry, 67 | 68 | module_startup_func: Some(zm_generic_rust_a_star), 69 | module_shutdown_func: Some(zm_generic_rust_a_star), 70 | request_startup_func: Some(zm_generic_rust_a_star), 71 | request_shutdown_func: Some(zm_generic_rust_a_star), 72 | info_func: Some(zm_info_rust_a_star), 73 | 74 | version: b"0.1.0\0" as *const [u8] as *const i8, 75 | globals_size: 0, 76 | globals_ptr: 0 as *const c_void, 77 | globals_ctor: None, 78 | globals_dtor: None, 79 | post_deactivate_func: None, 80 | module_started: 0, 81 | _type: 0, 82 | handle: 0 as *const c_void, 83 | module_number: 0, 84 | build_id: b"API20160303,NTS,debug\0" as *const [u8] as *const i8 85 | }; 86 | 87 | module_entry 88 | } 89 | -------------------------------------------------------------------------------- /src/rust_a_star.php: -------------------------------------------------------------------------------- 1 | c_int>, 26 | pub module_shutdown_func: Option c_int>, 27 | pub request_startup_func: Option c_int>, 28 | pub request_shutdown_func: Option c_int>, 29 | pub info_func: Option, 30 | pub version: *const c_char, 31 | pub globals_size: usize, 32 | pub globals_ptr: *const c_void, 33 | pub globals_ctor: Option, 34 | pub globals_dtor: Option, 35 | pub post_deactivate_func: Option c_int>, 36 | pub module_started: c_int, 37 | pub _type: c_uchar, 38 | pub handle: *const c_void, 39 | pub module_number: c_int, 40 | pub build_id: *const c_char 41 | } 42 | 43 | unsafe impl Sync for zend_module_entry {} 44 | 45 | #[repr(C)] 46 | pub struct zend_function_entry { 47 | pub fname: *const c_char, 48 | pub handler: Option, 49 | pub arg_info: *const _zend_arg_info, 50 | pub num_args: c_uint, 51 | pub flags: c_uint 52 | } 53 | 54 | unsafe impl Sync for zend_function_entry {} -------------------------------------------------------------------------------- /valgrind.md: -------------------------------------------------------------------------------- 1 | ## Valgrind 2 | ### with extension 3 | valgrind --leak-check=full ~/proj_/php/php-out/bin/php src/rust_a_star.php 4 | ==86419== Memcheck, a memory error detector 5 | ==86419== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al. 6 | ==86419== Using Valgrind-3.11.0 and LibVEX; rerun with -h for copyright info 7 | ==86419== Command: /Users/tim/proj_/php/php-out/bin/php src/rust_a_star.php 8 | ==86419== 9 | --86419-- UNKNOWN mach_msg unhandled MACH_SEND_TRAILER option 10 | --86419-- UNKNOWN mach_msg unhandled MACH_SEND_TRAILER option (repeated 2 times) 11 | --86419-- UNKNOWN mach_msg unhandled MACH_SEND_TRAILER option (repeated 4 times) 12 | --86419-- run: /usr/bin/dsymutil "/Users/tim/proj_/rust/hello_from_rust/target/debug/librust_a_star.dylib" 13 | warning: (x86_64) /Users/tim/proj_/rust/hello_from_rust/target/debug/deps/rust_a_star.0.o unable to open object file: No such file or directory 14 | warning: no debug symbols in executable (-arch x86_64) 15 | ==86419== Warning: ignored attempt to set SIGUSR2 handler in sigaction(); 16 | ==86419== the SIGUSR2 signal is used internally by Valgrind 17 | Could not startup. 18 | ==86419== 19 | ==86419== HEAP SUMMARY: 20 | ==86419== in use at exit: 39,771 bytes in 232 blocks 21 | ==86419== total heap usage: 12,532 allocs, 12,300 frees, 1,756,703 bytes allocated 22 | ==86419== 23 | ==86419== 2 bytes in 1 blocks are definitely lost in loss record 1 of 107 24 | ==86419== at 0x100D60EBB: malloc (in /usr/local/Cellar/valgrind/3.11.0/lib/valgrind/vgpreload_memcheck-amd64-darwin.so) 25 | ==86419== by 0x1020301BF: ??? 26 | ==86419== by 0x102030130: ??? 27 | ==86419== by 0x102030355: ??? 28 | ==86419== by 0x1020302FD: ??? 29 | ==86419== by 0x10204AB6B: ??? 30 | ==86419== by 0x10202FDB7: ??? 31 | ==86419== by 0x102030292: ??? 32 | ==86419== by 0x10203024C: ??? 33 | ==86419== by 0x1003CA679: php_load_extension (dl.c:162) 34 | ==86419== by 0x10048B16E: php_load_php_extension_cb (php_ini.c:344) 35 | ==86419== by 0x100510316: zend_llist_apply (zend_llist.c:184) 36 | ==86419== 37 | ==86419== 40 bytes in 1 blocks are definitely lost in loss record 47 of 107 38 | ==86419== at 0x100D60EBB: malloc (in /usr/local/Cellar/valgrind/3.11.0/lib/valgrind/vgpreload_memcheck-amd64-darwin.so) 39 | ==86419== by 0x1014AF568: _collecting_in_critical() (in /usr/lib/libobjc.A.dylib) 40 | ==86419== by 0x1014A9D4C: lookUpImpOrForward (in /usr/lib/libobjc.A.dylib) 41 | ==86419== by 0x1014A9CCE: lookUpImpOrForward (in /usr/lib/libobjc.A.dylib) 42 | ==86419== by 0x10145ED68: -[OS_xpc_object _xref_dispose] (in /usr/lib/system/libxpc.dylib) 43 | ==86419== by 0x10145FCC9: xpc_pipe_routine (in /usr/lib/system/libxpc.dylib) 44 | ==86419== by 0x10145F9DD: _xpc_interface_routine (in /usr/lib/system/libxpc.dylib) 45 | ==86419== by 0x10145F5C3: bootstrap_look_up3 (in /usr/lib/system/libxpc.dylib) 46 | ==86419== by 0x10145F4F8: bootstrap_look_up2 (in /usr/lib/system/libxpc.dylib) 47 | ==86419== by 0x1013E6907: ___notify_lib_init_block_invoke (in /usr/lib/system/libsystem_notify.dylib) 48 | ==86419== by 0x1010AA40A: _dispatch_client_callout (in /usr/lib/system/libdispatch.dylib) 49 | ==86419== by 0x1010AA302: dispatch_once_f (in /usr/lib/system/libdispatch.dylib) 50 | ==86419== 51 | ==86419== 64 bytes in 1 blocks are definitely lost in loss record 60 of 107 52 | ==86419== at 0x100D60EBB: malloc (in /usr/local/Cellar/valgrind/3.11.0/lib/valgrind/vgpreload_memcheck-amd64-darwin.so) 53 | ==86419== by 0x100F0A773: xmlNewMutex (in /usr/local/Cellar/libxml2/2.9.4/lib/libxml2.2.dylib) 54 | ==86419== by 0x100F09C72: xmlInitGlobals (in /usr/local/Cellar/libxml2/2.9.4/lib/libxml2.2.dylib) 55 | ==86419== by 0x100EB4B04: xmlInitParser (in /usr/local/Cellar/libxml2/2.9.4/lib/libxml2.2.dylib) 56 | ==86419== by 0x10005EC45: php_libxml_initialize (libxml.c:755) 57 | ==86419== by 0x10005DB95: zm_startup_libxml (libxml.c:794) 58 | ==86419== by 0x10052FEBC: zend_startup_module_ex (zend_API.c:1843) 59 | ==86419== by 0x1005307BF: zend_startup_module_zval (in /Users/tim/proj_/php/php-out/bin/php) 60 | ==86419== by 0x100541D7C: zend_hash_apply (zend_hash.c:1505) 61 | ==86419== by 0x1005305E6: zend_startup_modules (zend_API.c:1969) 62 | ==86419== by 0x10047ABFC: php_module_startup (main.c:2254) 63 | ==86419== by 0x100647C3A: php_cli_startup (php_cli.c:428) 64 | ==86419== 65 | ==86419== 64 bytes in 1 blocks are definitely lost in loss record 61 of 107 66 | ==86419== at 0x100D60EBB: malloc (in /usr/local/Cellar/valgrind/3.11.0/lib/valgrind/vgpreload_memcheck-amd64-darwin.so) 67 | ==86419== by 0x100F0A773: xmlNewMutex (in /usr/local/Cellar/libxml2/2.9.4/lib/libxml2.2.dylib) 68 | ==86419== by 0x100ECB6BB: xmlInitMemory (in /usr/local/Cellar/libxml2/2.9.4/lib/libxml2.2.dylib) 69 | ==86419== by 0x100EB4B2C: xmlInitParser (in /usr/local/Cellar/libxml2/2.9.4/lib/libxml2.2.dylib) 70 | ==86419== by 0x10005EC45: php_libxml_initialize (libxml.c:755) 71 | ==86419== by 0x10005DB95: zm_startup_libxml (libxml.c:794) 72 | ==86419== by 0x10052FEBC: zend_startup_module_ex (zend_API.c:1843) 73 | ==86419== by 0x1005307BF: zend_startup_module_zval (in /Users/tim/proj_/php/php-out/bin/php) 74 | ==86419== by 0x100541D7C: zend_hash_apply (zend_hash.c:1505) 75 | ==86419== by 0x1005305E6: zend_startup_modules (zend_API.c:1969) 76 | ==86419== by 0x10047ABFC: php_module_startup (main.c:2254) 77 | ==86419== by 0x100647C3A: php_cli_startup (php_cli.c:428) 78 | ==86419== 79 | ==86419== 104 (56 direct, 48 indirect) bytes in 1 blocks are definitely lost in loss record 71 of 107 80 | ==86419== at 0x100D615B9: calloc (in /usr/local/Cellar/valgrind/3.11.0/lib/valgrind/vgpreload_memcheck-amd64-darwin.so) 81 | ==86419== by 0x1014A95BA: call_load_methods (in /usr/lib/libobjc.A.dylib) 82 | ==86419== by 0x1014A951F: call_load_methods (in /usr/lib/libobjc.A.dylib) 83 | ==86419== by 0x1014A91D8: prepare_load_methods (in /usr/lib/libobjc.A.dylib) 84 | ==86419== by 0x1014A9155: class_createInstance (in /usr/lib/libobjc.A.dylib) 85 | ==86419== by 0x1014A9155: class_createInstance (in /usr/lib/libobjc.A.dylib) 86 | ==86419== by 0x1014A9155: class_createInstance (in /usr/lib/libobjc.A.dylib) 87 | ==86419== by 0x1014A8D07: NXMapRemove (in /usr/lib/libobjc.A.dylib) 88 | ==86419== by 0x1014A3590: objc_msgSend (in /usr/lib/libobjc.A.dylib) 89 | ==86419== by 0x10145FCC9: xpc_pipe_routine (in /usr/lib/system/libxpc.dylib) 90 | ==86419== by 0x10145F9DD: _xpc_interface_routine (in /usr/lib/system/libxpc.dylib) 91 | ==86419== by 0x10145F5C3: bootstrap_look_up3 (in /usr/lib/system/libxpc.dylib) 92 | ==86419== 93 | ==86419== 128 bytes in 1 blocks are definitely lost in loss record 78 of 107 94 | ==86419== at 0x100D60EBB: malloc (in /usr/local/Cellar/valgrind/3.11.0/lib/valgrind/vgpreload_memcheck-amd64-darwin.so) 95 | ==86419== by 0x100F0A7EE: xmlNewRMutex (in /usr/local/Cellar/libxml2/2.9.4/lib/libxml2.2.dylib) 96 | ==86419== by 0x100F55ACF: __xmlInitializeDict (in /usr/local/Cellar/libxml2/2.9.4/lib/libxml2.2.dylib) 97 | ==86419== by 0x101404BF5: __pthread_once_handler (in /usr/lib/system/libsystem_pthread.dylib) 98 | ==86419== by 0x1013F0FC3: _os_once (in /usr/lib/system/libsystem_platform.dylib) 99 | ==86419== by 0x101404B94: pthread_once (in /usr/lib/system/libsystem_pthread.dylib) 100 | ==86419== by 0x100F0AA3C: xmlIsMainThread (in /usr/local/Cellar/libxml2/2.9.4/lib/libxml2.2.dylib) 101 | ==86419== by 0x100F0A2BB: __xmlGenericError (in /usr/local/Cellar/libxml2/2.9.4/lib/libxml2.2.dylib) 102 | ==86419== by 0x100EB4B09: xmlInitParser (in /usr/local/Cellar/libxml2/2.9.4/lib/libxml2.2.dylib) 103 | ==86419== by 0x10005EC45: php_libxml_initialize (libxml.c:755) 104 | ==86419== by 0x10005DB95: zm_startup_libxml (libxml.c:794) 105 | ==86419== by 0x10052FEBC: zend_startup_module_ex (zend_API.c:1843) 106 | ==86419== 107 | ==86419== 2,064 bytes in 1 blocks are possibly lost in loss record 101 of 107 108 | ==86419== at 0x100D6117C: malloc_zone_malloc (in /usr/local/Cellar/valgrind/3.11.0/lib/valgrind/vgpreload_memcheck-amd64-darwin.so) 109 | ==86419== by 0x1014B3EFD: _objc_copyClassNamesForImage (in /usr/lib/libobjc.A.dylib) 110 | ==86419== by 0x1014A7182: protocols() (in /usr/lib/libobjc.A.dylib) 111 | ==86419== by 0x1014A7093: readClass(objc_class*, bool, bool) (in /usr/lib/libobjc.A.dylib) 112 | ==86419== by 0x1014A4C13: gc_init (in /usr/lib/libobjc.A.dylib) 113 | ==86419== by 0x1014AC24E: objc_initializeClassPair_internal(objc_class*, char const*, objc_class*, objc_class*) (in /usr/lib/libobjc.A.dylib) 114 | ==86419== by 0x1014B9132: layout_string_create (in /usr/lib/libobjc.A.dylib) 115 | ==86419== by 0x1014A783C: realizeClass(objc_class*) (in /usr/lib/libobjc.A.dylib) 116 | ==86419== by 0x1014A7300: copySwiftV1MangledName(char const*, bool) (in /usr/lib/libobjc.A.dylib) 117 | ==86419== by 0x1014A72E9: copySwiftV1MangledName(char const*, bool) (in /usr/lib/libobjc.A.dylib) 118 | ==86419== by 0x1014A72E9: copySwiftV1MangledName(char const*, bool) (in /usr/lib/libobjc.A.dylib) 119 | ==86419== by 0x1014A72E9: copySwiftV1MangledName(char const*, bool) (in /usr/lib/libobjc.A.dylib) 120 | ==86419== 121 | ==86419== LEAK SUMMARY: 122 | ==86419== definitely lost: 354 bytes in 6 blocks 123 | ==86419== indirectly lost: 48 bytes in 2 blocks 124 | ==86419== possibly lost: 2,064 bytes in 1 blocks 125 | ==86419== still reachable: 17,080 bytes in 38 blocks 126 | ==86419== suppressed: 20,225 bytes in 185 blocks 127 | ==86419== Reachable blocks (those to which a pointer was found) are not shown. 128 | ==86419== To see them, rerun with: --leak-check=full --show-leak-kinds=all 129 | ==86419== 130 | ==86419== For counts of detected and suppressed errors, rerun with: -v 131 | ==86419== ERROR SUMMARY: 7 errors from 7 contexts (suppressed: 20 from 20) 132 | make: *** [valgrind] Error 1 133 | 134 | ### without extension 135 | 136 | valgrind --leak-check=full ~/proj_/php/php-out/bin/php src/rust_a_star.php 137 | ==86521== Memcheck, a memory error detector 138 | ==86521== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al. 139 | ==86521== Using Valgrind-3.11.0 and LibVEX; rerun with -h for copyright info 140 | ==86521== Command: /Users/tim/proj_/php/php-out/bin/php src/rust_a_star.php 141 | ==86521== 142 | --86521-- UNKNOWN mach_msg unhandled MACH_SEND_TRAILER option 143 | --86521-- UNKNOWN mach_msg unhandled MACH_SEND_TRAILER option (repeated 2 times) 144 | --86521-- UNKNOWN mach_msg unhandled MACH_SEND_TRAILER option (repeated 4 times) 145 | ==86521== Warning: ignored attempt to set SIGUSR2 handler in sigaction(); 146 | ==86521== the SIGUSR2 signal is used internally by Valgrind 147 | Could not startup. 148 | ==86521== 149 | ==86521== HEAP SUMMARY: 150 | ==86521== in use at exit: 39,433 bytes in 229 blocks 151 | ==86521== total heap usage: 12,517 allocs, 12,288 frees, 1,755,502 bytes allocated 152 | ==86521== 153 | ==86521== 40 bytes in 1 blocks are definitely lost in loss record 46 of 104 154 | ==86521== at 0x100D60EBB: malloc (in /usr/local/Cellar/valgrind/3.11.0/lib/valgrind/vgpreload_memcheck-amd64-darwin.so) 155 | ==86521== by 0x1014AF568: _collecting_in_critical() (in /usr/lib/libobjc.A.dylib) 156 | ==86521== by 0x1014A9D4C: lookUpImpOrForward (in /usr/lib/libobjc.A.dylib) 157 | ==86521== by 0x1014A9CCE: lookUpImpOrForward (in /usr/lib/libobjc.A.dylib) 158 | ==86521== by 0x10145ED68: -[OS_xpc_object _xref_dispose] (in /usr/lib/system/libxpc.dylib) 159 | ==86521== by 0x10145FCC9: xpc_pipe_routine (in /usr/lib/system/libxpc.dylib) 160 | ==86521== by 0x10145F9DD: _xpc_interface_routine (in /usr/lib/system/libxpc.dylib) 161 | ==86521== by 0x10145F5C3: bootstrap_look_up3 (in /usr/lib/system/libxpc.dylib) 162 | ==86521== by 0x10145F4F8: bootstrap_look_up2 (in /usr/lib/system/libxpc.dylib) 163 | ==86521== by 0x1013E6907: ___notify_lib_init_block_invoke (in /usr/lib/system/libsystem_notify.dylib) 164 | ==86521== by 0x1010AA40A: _dispatch_client_callout (in /usr/lib/system/libdispatch.dylib) 165 | ==86521== by 0x1010AA302: dispatch_once_f (in /usr/lib/system/libdispatch.dylib) 166 | ==86521== 167 | ==86521== 64 bytes in 1 blocks are definitely lost in loss record 59 of 104 168 | ==86521== at 0x100D60EBB: malloc (in /usr/local/Cellar/valgrind/3.11.0/lib/valgrind/vgpreload_memcheck-amd64-darwin.so) 169 | ==86521== by 0x100F0A773: xmlNewMutex (in /usr/local/Cellar/libxml2/2.9.4/lib/libxml2.2.dylib) 170 | ==86521== by 0x100F09C72: xmlInitGlobals (in /usr/local/Cellar/libxml2/2.9.4/lib/libxml2.2.dylib) 171 | ==86521== by 0x100EB4B04: xmlInitParser (in /usr/local/Cellar/libxml2/2.9.4/lib/libxml2.2.dylib) 172 | ==86521== by 0x10005EC45: php_libxml_initialize (libxml.c:755) 173 | ==86521== by 0x10005DB95: zm_startup_libxml (libxml.c:794) 174 | ==86521== by 0x10052FEBC: zend_startup_module_ex (zend_API.c:1843) 175 | ==86521== by 0x1005307BF: zend_startup_module_zval (in /Users/tim/proj_/php/php-out/bin/php) 176 | ==86521== by 0x100541D7C: zend_hash_apply (zend_hash.c:1505) 177 | ==86521== by 0x1005305E6: zend_startup_modules (zend_API.c:1969) 178 | ==86521== by 0x10047ABFC: php_module_startup (main.c:2254) 179 | ==86521== by 0x100647C3A: php_cli_startup (php_cli.c:428) 180 | ==86521== 181 | ==86521== 64 bytes in 1 blocks are definitely lost in loss record 60 of 104 182 | ==86521== at 0x100D60EBB: malloc (in /usr/local/Cellar/valgrind/3.11.0/lib/valgrind/vgpreload_memcheck-amd64-darwin.so) 183 | ==86521== by 0x100F0A773: xmlNewMutex (in /usr/local/Cellar/libxml2/2.9.4/lib/libxml2.2.dylib) 184 | ==86521== by 0x100ECB6BB: xmlInitMemory (in /usr/local/Cellar/libxml2/2.9.4/lib/libxml2.2.dylib) 185 | ==86521== by 0x100EB4B2C: xmlInitParser (in /usr/local/Cellar/libxml2/2.9.4/lib/libxml2.2.dylib) 186 | ==86521== by 0x10005EC45: php_libxml_initialize (libxml.c:755) 187 | ==86521== by 0x10005DB95: zm_startup_libxml (libxml.c:794) 188 | ==86521== by 0x10052FEBC: zend_startup_module_ex (zend_API.c:1843) 189 | ==86521== by 0x1005307BF: zend_startup_module_zval (in /Users/tim/proj_/php/php-out/bin/php) 190 | ==86521== by 0x100541D7C: zend_hash_apply (zend_hash.c:1505) 191 | ==86521== by 0x1005305E6: zend_startup_modules (zend_API.c:1969) 192 | ==86521== by 0x10047ABFC: php_module_startup (main.c:2254) 193 | ==86521== by 0x100647C3A: php_cli_startup (php_cli.c:428) 194 | ==86521== 195 | ==86521== 104 (56 direct, 48 indirect) bytes in 1 blocks are definitely lost in loss record 70 of 104 196 | ==86521== at 0x100D615B9: calloc (in /usr/local/Cellar/valgrind/3.11.0/lib/valgrind/vgpreload_memcheck-amd64-darwin.so) 197 | ==86521== by 0x1014A95BA: call_load_methods (in /usr/lib/libobjc.A.dylib) 198 | ==86521== by 0x1014A951F: call_load_methods (in /usr/lib/libobjc.A.dylib) 199 | ==86521== by 0x1014A91D8: prepare_load_methods (in /usr/lib/libobjc.A.dylib) 200 | ==86521== by 0x1014A9155: class_createInstance (in /usr/lib/libobjc.A.dylib) 201 | ==86521== by 0x1014A9155: class_createInstance (in /usr/lib/libobjc.A.dylib) 202 | ==86521== by 0x1014A9155: class_createInstance (in /usr/lib/libobjc.A.dylib) 203 | ==86521== by 0x1014A8D07: NXMapRemove (in /usr/lib/libobjc.A.dylib) 204 | ==86521== by 0x1014A3590: objc_msgSend (in /usr/lib/libobjc.A.dylib) 205 | ==86521== by 0x10145FCC9: xpc_pipe_routine (in /usr/lib/system/libxpc.dylib) 206 | ==86521== by 0x10145F9DD: _xpc_interface_routine (in /usr/lib/system/libxpc.dylib) 207 | ==86521== by 0x10145F5C3: bootstrap_look_up3 (in /usr/lib/system/libxpc.dylib) 208 | ==86521== 209 | ==86521== 128 bytes in 1 blocks are definitely lost in loss record 76 of 104 210 | ==86521== at 0x100D60EBB: malloc (in /usr/local/Cellar/valgrind/3.11.0/lib/valgrind/vgpreload_memcheck-amd64-darwin.so) 211 | ==86521== by 0x100F0A7EE: xmlNewRMutex (in /usr/local/Cellar/libxml2/2.9.4/lib/libxml2.2.dylib) 212 | ==86521== by 0x100F55ACF: __xmlInitializeDict (in /usr/local/Cellar/libxml2/2.9.4/lib/libxml2.2.dylib) 213 | ==86521== by 0x101404BF5: __pthread_once_handler (in /usr/lib/system/libsystem_pthread.dylib) 214 | ==86521== by 0x1013F0FC3: _os_once (in /usr/lib/system/libsystem_platform.dylib) 215 | ==86521== by 0x101404B94: pthread_once (in /usr/lib/system/libsystem_pthread.dylib) 216 | ==86521== by 0x100F0AA3C: xmlIsMainThread (in /usr/local/Cellar/libxml2/2.9.4/lib/libxml2.2.dylib) 217 | ==86521== by 0x100F0A2BB: __xmlGenericError (in /usr/local/Cellar/libxml2/2.9.4/lib/libxml2.2.dylib) 218 | ==86521== by 0x100EB4B09: xmlInitParser (in /usr/local/Cellar/libxml2/2.9.4/lib/libxml2.2.dylib) 219 | ==86521== by 0x10005EC45: php_libxml_initialize (libxml.c:755) 220 | ==86521== by 0x10005DB95: zm_startup_libxml (libxml.c:794) 221 | ==86521== by 0x10052FEBC: zend_startup_module_ex (zend_API.c:1843) 222 | ==86521== 223 | ==86521== 2,064 bytes in 1 blocks are possibly lost in loss record 98 of 104 224 | ==86521== at 0x100D6117C: malloc_zone_malloc (in /usr/local/Cellar/valgrind/3.11.0/lib/valgrind/vgpreload_memcheck-amd64-darwin.so) 225 | ==86521== by 0x1014B3EFD: _objc_copyClassNamesForImage (in /usr/lib/libobjc.A.dylib) 226 | ==86521== by 0x1014A7182: protocols() (in /usr/lib/libobjc.A.dylib) 227 | ==86521== by 0x1014A7093: readClass(objc_class*, bool, bool) (in /usr/lib/libobjc.A.dylib) 228 | ==86521== by 0x1014A4C13: gc_init (in /usr/lib/libobjc.A.dylib) 229 | ==86521== by 0x1014AC24E: objc_initializeClassPair_internal(objc_class*, char const*, objc_class*, objc_class*) (in /usr/lib/libobjc.A.dylib) 230 | ==86521== by 0x1014B9132: layout_string_create (in /usr/lib/libobjc.A.dylib) 231 | ==86521== by 0x1014A783C: realizeClass(objc_class*) (in /usr/lib/libobjc.A.dylib) 232 | ==86521== by 0x1014A7300: copySwiftV1MangledName(char const*, bool) (in /usr/lib/libobjc.A.dylib) 233 | ==86521== by 0x1014A72E9: copySwiftV1MangledName(char const*, bool) (in /usr/lib/libobjc.A.dylib) 234 | ==86521== by 0x1014A72E9: copySwiftV1MangledName(char const*, bool) (in /usr/lib/libobjc.A.dylib) 235 | ==86521== by 0x1014A72E9: copySwiftV1MangledName(char const*, bool) (in /usr/lib/libobjc.A.dylib) 236 | ==86521== 237 | ==86521== LEAK SUMMARY: 238 | ==86521== definitely lost: 352 bytes in 5 blocks 239 | ==86521== indirectly lost: 48 bytes in 2 blocks 240 | ==86521== possibly lost: 2,064 bytes in 1 blocks 241 | ==86521== still reachable: 16,744 bytes in 36 blocks 242 | ==86521== suppressed: 20,225 bytes in 185 blocks 243 | ==86521== Reachable blocks (those to which a pointer was found) are not shown. 244 | ==86521== To see them, rerun with: --leak-check=full --show-leak-kinds=all 245 | ==86521== 246 | ==86521== For counts of detected and suppressed errors, rerun with: -v 247 | ==86521== ERROR SUMMARY: 6 errors from 6 contexts (suppressed: 20 from 20) 248 | make: *** [valgrind] Error 1 --------------------------------------------------------------------------------