valgrind

valgrind

前几日公司大牛告诉我写c经常需要检查读写错误可以用valgrind。。。大牛就是好哈哈哈哈哈

安装

sudo apt  install valgrind

使用:

USE_ZEND_ALLOC=0 valgrind php c.php

返回:

==22537== Memcheck, a memory error detector
==22537== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==22537== Using Valgrind-3.13.0 and LibVEX; rerun with -h for copyright info
==22537== Command: php a.php
==22537== 
==22537== Conditional jump or move depends on uninitialised value(s)
==22537==    at 0x5F0082: zend_string_equal_val (zend_string.c:403)
==22537==    by 0x5D927F: zend_string_equal_content (zend_string.h:310)
==22537==    by 0x5D927F: zend_hash_find_bucket (zend_hash.c:593)
==22537==    by 0x5D927F: zend_hash_find (zend_hash.c:2090)
==22537==    by 0x5B6969: zend_get_constant_impl (zend_constants.c:279)
==22537==    by 0x599763: zend_ini_get_constant (zend_ini_parser.c:221)
==22537==    by 0x599763: ini_parse (zend_ini_parser.c:1925)
==22537==    by 0x599CBF: zend_parse_ini_file (zend_ini_parser.c:307)
==22537==    by 0x56D9FC: php_init_config (php_ini.c:630)
==22537==    by 0x566C30: php_module_startup (main.c:2270)
==22537==    by 0x655A0C: php_cli_startup (php_cli.c:420)
==22537==    by 0x235ECD: main (php_cli.c:1356)
==22537== 
==22537== Conditional jump or move depends on uninitialised value(s)
==22537==    at 0x5F0082: zend_string_equal_val (zend_string.c:403)
==22537==    by 0x5D3D87: zend_string_equal_content (zend_string.h:310)
==22537==    by 0x5D3D87: zend_hash_find_bucket (zend_hash.c:593)
==22537==    by 0x5D3D87: _zend_hash_add_or_update_i (zend_hash.c:676)
==22537==    by 0x5D3D87: zend_hash_update (zend_hash.c:823)
==22537==    by 0x56D011: php_ini_parser_cb (php_ini.c:239)
==22537==    by 0x5992D9: ini_parse (zend_ini_parser.c:1674)
==22537==    by 0x599CBF: zend_parse_ini_file (zend_ini_parser.c:307)
==22537==    by 0x56D9FC: php_init_config (php_ini.c:630)
==22537==    by 0x566C30: php_module_startup (main.c:2270)
==22537==    by 0x655A0C: php_cli_startup (php_cli.c:420)
==22537==    by 0x235ECD: main (php_cli.c:1356)
==22537== 
==22537== Conditional jump or move depends on uninitialised value(s)
==22537==    at 0x5F0082: zend_string_equal_val (zend_string.c:403)
==22537==    by 0x5D927F: zend_string_equal_content (zend_string.h:310)
==22537==    by 0x5D927F: zend_hash_find_bucket (zend_hash.c:593)
==22537==    by 0x5D927F: zend_hash_find (zend_hash.c:2090)
==22537==    by 0x5E0E8C: zend_register_ini_entries (zend_ini.c:258)
==22537==    by 0x566C47: php_module_startup (main.c:2275)
==22537==    by 0x655A0C: php_cli_startup (php_cli.c:420)
==22537==    by 0x235ECD: main (php_cli.c:1356)
==22537== 
==22537== Conditional jump or move depends on uninitialised value(s)
==22537==    at 0x5F0082: zend_string_equal_val (zend_string.c:403)
==22537==    by 0x5F03C6: zend_string_equal_content (zend_string.h:310)
==22537==    by 0x5F03C6: zend_interned_string_ht_lookup (zend_string.c:156)
==22537==    by 0x5F03C6: zend_new_interned_string_permanent.part.1 (zend_string.c:196)
==22537==    by 0x5E0DE5: zend_register_ini_entries (zend_ini.c:261)
==22537==    by 0x566C47: php_module_startup (main.c:2275)
==22537==    by 0x655A0C: php_cli_startup (php_cli.c:420)
==22537==    by 0x235ECD: main (php_cli.c:1356)
==22537== 
==22537== Conditional jump or move depends on uninitialised value(s)
==22537==    at 0x5F0082: zend_string_equal_val (zend_string.c:403)
==22537==    by 0x5F03C6: zend_string_equal_content (zend_string.h:310)
==22537==    by 0x5F03C6: zend_interned_string_ht_lookup (zend_string.c:156)
==22537==    by 0x5F03C6: zend_new_interned_string_permanent.part.1 (zend_string.c:196)
==22537==    by 0x5E0DE5: zend_register_ini_entries (zend_ini.c:261)
==22537==    by 0x566C4C: php_module_startup (main.c:2278)
==22537==    by 0x655A0C: php_cli_startup (php_cli.c:420)
==22537==    by 0x235ECD: main (php_cli.c:1356)
==22537== 
==22537== Conditional jump or move depends on uninitialised value(s)
==22537==    at 0x5F0082: zend_string_equal_val (zend_string.c:403)
==22537==    by 0x5D927F: zend_string_equal_content (zend_string.h:310)
==22537==    by 0x5D927F: zend_hash_find_bucket (zend_hash.c:593)
==22537==    by 0x5D927F: zend_hash_find (zend_hash.c:2090)
==22537==    by 0x5E0E8C: zend_register_ini_entries (zend_ini.c:258)
==22537==    by 0x566C4C: php_module_startup (main.c:2278)
==22537==    by 0x655A0C: php_cli_startup (php_cli.c:420)
==22537==    by 0x235ECD: main (php_cli.c:1356)
==22537== 
==22537== Conditional jump or move depends on uninitialised value(s)
==22537==    at 0x5F0082: zend_string_equal_val (zend_string.c:403)
==22537==    by 0x5F03C6: zend_string_equal_content (zend_string.h:310)
==22537==    by 0x5F03C6: zend_interned_string_ht_lookup (zend_string.c:156)
==22537==    by 0x5F03C6: zend_new_interned_string_permanent.part.1 (zend_string.c:196)
==22537==    by 0x5CB2C6: zend_register_functions (zend_API.c:2283)
==22537==    by 0x5CC482: do_register_internal_class (zend_API.c:2727)
==22537==    by 0x5CC98C: zend_register_internal_class_ex (zend_API.c:2747)
==22537==    by 0x5E7C9E: zend_register_default_exception (zend_exceptions.c:815)
==22537==    by 0x5FD9CD: zend_register_default_classes (zend_default_classes.c:32)
==22537==    by 0x5DECDA: zm_startup_core (zend_builtin_functions.c:307)
==22537==    by 0x5CA5F2: zend_startup_module_ex (zend_API.c:1878)
==22537==    by 0x5CA69B: zend_startup_module_zval (zend_API.c:1893)
==22537==    by 0x5D7521: zend_hash_apply (zend_hash.c:1688)
==22537==    by 0x5CA989: zend_startup_modules (zend_API.c:2004)
==22537== 
==22537== Conditional jump or move depends on uninitialised value(s)
==22537==    at 0x5F0082: zend_string_equal_val (zend_string.c:403)
==22537==    by 0x5F03C6: zend_string_equal_content (zend_string.h:310)
==22537==    by 0x5F03C6: zend_interned_string_ht_lookup (zend_string.c:156)
==22537==    by 0x5F03C6: zend_new_interned_string_permanent.part.1 (zend_string.c:196)
==22537==    by 0x5D0676: zval_make_interned_string (zend_API.c:3681)
==22537==    by 0x5D0676: zend_declare_property_ex (zend_API.c:3702)
==22537==    by 0x5D0899: zend_declare_property (zend_API.c:3772)
==22537==    by 0x5D0AF7: zend_declare_property_string (zend_API.c:3819)
==22537==    by 0x5E7CE4: zend_register_default_exception (zend_exceptions.c:819)
==22537==    by 0x5FD9CD: zend_register_default_classes (zend_default_classes.c:32)
==22537==    by 0x5DECDA: zm_startup_core (zend_builtin_functions.c:307)
==22537==    by 0x5CA5F2: zend_startup_module_ex (zend_API.c:1878)
==22537==    by 0x5CA69B: zend_startup_module_zval (zend_API.c:1893)
==22537==    by 0x5D7521: zend_hash_apply (zend_hash.c:1688)
==22537==    by 0x5CA989: zend_startup_modules (zend_API.c:2004)
==22537== 
==22537== Conditional jump or move depends on uninitialised value(s)
==22537==    at 0x5F0082: zend_string_equal_val (zend_string.c:403)
==22537==    by 0x5F03C6: zend_string_equal_content (zend_string.h:310)
==22537==    by 0x5F03C6: zend_interned_string_ht_lookup (zend_string.c:156)
==22537==    by 0x5F03C6: zend_new_interned_string_permanent.part.1 (zend_string.c:196)
==22537==    by 0x5D05DD: zend_declare_property_ex (zend_API.c:3747)
==22537==    by 0x5D0899: zend_declare_property (zend_API.c:3772)
==22537==    by 0x5D0AF7: zend_declare_property_string (zend_API.c:3819)
==22537==    by 0x5E7D06: zend_register_default_exception (zend_exceptions.c:820)
==22537==    by 0x5FD9CD: zend_register_default_classes (zend_default_classes.c:32)
==22537==    by 0x5DECDA: zm_startup_core (zend_builtin_functions.c:307)
==22537==    by 0x5CA5F2: zend_startup_module_ex (zend_API.c:1878)
==22537==    by 0x5CA69B: zend_startup_module_zval (zend_API.c:1893)
==22537==    by 0x5D7521: zend_hash_apply (zend_hash.c:1688)
==22537==    by 0x5CA989: zend_startup_modules (zend_API.c:2004)
==22537== 
==22537== Conditional jump or move depends on uninitialised value(s)
==22537==    at 0x5F0082: zend_string_equal_val (zend_string.c:403)
==22537==    by 0x5F03C6: zend_string_equal_content (zend_string.h:310)
==22537==    by 0x5F03C6: zend_interned_string_ht_lookup (zend_string.c:156)
==22537==    by 0x5F03C6: zend_new_interned_string_permanent.part.1 (zend_string.c:196)
==22537==    by 0x5D0608: zend_declare_property_ex (zend_API.c:3759)
==22537==    by 0x5D0899: zend_declare_property (zend_API.c:3772)
==22537==    by 0x5D0AF7: zend_declare_property_string (zend_API.c:3819)
==22537==    by 0x5E7E8A: zend_register_default_exception (zend_exceptions.c:837)
==22537==    by 0x5FD9CD: zend_register_default_classes (zend_default_classes.c:32)
==22537==    by 0x5DECDA: zm_startup_core (zend_builtin_functions.c:307)
==22537==    by 0x5CA5F2: zend_startup_module_ex (zend_API.c:1878)
==22537==    by 0x5CA69B: zend_startup_module_zval (zend_API.c:1893)
==22537==    by 0x5D7521: zend_hash_apply (zend_hash.c:1688)
==22537==    by 0x5CA989: zend_startup_modules (zend_API.c:2004)
==22537== 
==22537== Conditional jump or move depends on uninitialised value(s)
==22537==    at 0x5F0082: zend_string_equal_val (zend_string.c:403)
==22537==    by 0x5F03C6: zend_string_equal_content (zend_string.h:310)
==22537==    by 0x5F03C6: zend_interned_string_ht_lookup (zend_string.c:156)
==22537==    by 0x5F03C6: zend_new_interned_string_permanent.part.1 (zend_string.c:196)
==22537==    by 0x5D0D4D: zval_make_interned_string (zend_API.c:3681)
==22537==    by 0x5D0D4D: zend_declare_class_constant_ex (zend_API.c:3848)
==22537==    by 0x5D0EB9: zend_declare_class_constant (zend_API.c:3884)
==22537==    by 0x5D110E: zend_declare_class_constant_stringl (zend_API.c:3931)
==22537==    by 0x23B22F: date_register_classes (php_date.c:2113)
==22537==    by 0x23BBA3: zm_startup_date (php_date.c:876)
==22537==    by 0x5CA5F2: zend_startup_module_ex (zend_API.c:1878)
==22537==    by 0x5CA69B: zend_startup_module_zval (zend_API.c:1893)
==22537==    by 0x5D7521: zend_hash_apply (zend_hash.c:1688)
==22537==    by 0x5CA989: zend_startup_modules (zend_API.c:2004)
==22537==    by 0x566CFA: php_module_startup (main.c:2333)
==22537== 
^C==22537== 
==22537== Process terminating with default action of signal 2 (SIGINT)
==22537==    at 0x5ED6070: malloc (malloc.c:3028)
==22537==    by 0x59D888: __zend_malloc (zend_alloc.c:2904)
==22537==    by 0x5EFA04: zend_string_alloc (zend_string.h:133)
==22537==    by 0x5EFA04: zend_string_init (zend_string.h:155)
==22537==    by 0x5EFA04: zend_string_init_interned_permanent (zend_string.c:260)
==22537==    by 0x5B759B: zend_register_long_constant (zend_constants.c:175)
==22537==    by 0x38B290: zm_startup_curl (interface.c:838)
==22537==    by 0x5CA5F2: zend_startup_module_ex (zend_API.c:1878)
==22537==    by 0x5CA69B: zend_startup_module_zval (zend_API.c:1893)
==22537==    by 0x5D7521: zend_hash_apply (zend_hash.c:1688)
==22537==    by 0x5CA989: zend_startup_modules (zend_API.c:2004)
==22537==    by 0x566CFA: php_module_startup (main.c:2333)
==22537==    by 0x655A0C: php_cli_startup (php_cli.c:420)
==22537==    by 0x235ECD: main (php_cli.c:1356)
==22537== 
==22537== HEAP SUMMARY:
==22537==     in use at exit: 880,381 bytes in 5,845 blocks
==22537==   total heap usage: 7,046 allocs, 1,201 frees, 1,199,239 bytes allocated
==22537== 
==22537== LEAK SUMMARY:
==22537==    definitely lost: 0 bytes in 0 blocks
==22537==    indirectly lost: 0 bytes in 0 blocks
==22537==      possibly lost: 563,832 bytes in 4,010 blocks
==22537==    still reachable: 316,549 bytes in 1,835 blocks
==22537==         suppressed: 0 bytes in 0 blocks
==22537== Rerun with --leak-check=full to see details of leaked memory
==22537== 
==22537== For counts of detected and suppressed errors, rerun with: -v
==22537== Use --track-origins=yes to see where uninitialised values come from
==22537== ERROR SUMMARY: 100 errors from 11 contexts (suppressed: 0 from 0)
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值