- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在编写一个 shell,但在执行内存检查时遇到问题,因为 valgrind 无法正常运行。
我遇到了这样的错误(我自己杀死了它):
==19703== Memcheck, a memory error detector
==19703== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==19703== Using Valgrind-3.13.0 and LibVEX; rerun with -h for copyright info
==19703== Command: ./tmpsh
==19703==
--19703-- run: /usr/bin/dsymutil "./tmpsh"
==19703== Warning: set address range perms: large range [0xffffffff000, 0x120000000000) (defined)
==19703== Warning: set address range perms: large range [0x140000000000, 0x200000000000) (defined)
==19703== Warning: set address range perms: large range [0x120000000000, 0x140000000000) (noaccess)
[1] 19703 killed valgrind --leak-check=yes ./tmpsh
某处似乎有巨大的分配,我能够使用如下代码生成类似的错误消息。
#include <stdlib.h>
#include <limits.h>
#include <stdlib.h>
#include <stdio.h>
struct test
{
void *val;
void *val1;
void *val2;
void *val3;
};
int main(int argc, char **argv)
{
int x;
char *ptr;
x = 0;
while (x++ < 500)
{
ptr = malloc(sizeof(struct test) * UINT_MAX);
printf("%p\n", ptr);
x++;
}
return (0);
}
使用这样的 valgrind 输出:
==22340== Memcheck, a memory error detector
==22340== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==22340== Using Valgrind-3.13.0 and LibVEX; rerun with -h for copyright info
==22340== Command: ./a.out
==22340==
==22340== Syscall param msg->desc.port.name points to uninitialised byte(s)
...
ImageLoader::runInitializers(ImageLoader::LinkContext const&, ImageLoader::InitializerTimingList&) (in /usr/lib/dyld)
==22340== Address 0x10488bc8c is on thread 1's stack
==22340== in frame #2, created by task_set_special_port (???:)
==22340==
==22340== Warning: set address range perms: large range [0x259c3a040, 0x2259c3a020) (undefined)
0x259c3a040
==22340== Warning: set address range perms: large range [0x2259c3b040, 0x4259c3b020) (undefined)
0x2259c3b040
...
但在这种情况下,我的程序正在运行,因为我可以使用 printf。
因此,我删除了所有代码并拥有类似的 main 以避免 malloc,但仍然遇到相同的错误:
int main(int argc, char **argv)
{
t_hist *history;
int status;
status = 0;
return (status);
}
我的项目包含大量文件,并与单个静态 (.a) 库链接。
这个巨大的分配可能来自 valgrind 吗?它可能来 self 的项目架构吗?感谢您的帮助
几分钟后获得完整日志,而无需自己杀死它
==22900== Memcheck, a memory error detector
==22900== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==22900== Using Valgrind-3.13.0 and LibVEX; rerun with -h for copyright info
==22900== Command: ./tmpsh
==22900==
==22900== Warning: set address range perms: large range [0xffffffff000, 0x120000000000) (defined)
==22900== Warning: set address range perms: large range [0x140000000000, 0x200000000000) (defined)
==22900== Warning: set address range perms: large range [0x120000000000, 0x140000000000) (noaccess)
==22900== Warning: set address range perms: large range [0x600000000000, 0x640000003000) (noaccess)
==22900== Conditional jump or move depends on uninitialised value(s)
==22900== at 0x10018CFAD: __sanitizer::StackDepotReverseMap::StackDepotReverseMap() (in /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/9.0.0/lib/darwin/libclang_rt.asan_osx_dynamic.dylib)
==22900== by 0x100184FC8: __sanitizer::RegisterCommonFlags(__sanitizer::FlagParser*, __sanitizer::CommonFlags*) (in /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/9.0.0/lib/darwin/libclang_rt.asan_osx_dynamic.dylib)
==22900== by 0x10019C6DE: handleFunctionTypeMismatch(__ubsan::FunctionTypeMismatchData*, unsigned long, __ubsan::ReportOptions) (in /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/9.0.0/lib/darwin/libclang_rt.asan_osx_dynamic.dylib)
==22900== by 0x10019B2E6: handleShiftOutOfBoundsImpl(__ubsan::ShiftOutOfBoundsData*, unsigned long, unsigned long, __ubsan::ReportOptions) (in /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/9.0.0/lib/darwin/libclang_rt.asan_osx_dynamic.dylib)
==22900== by 0x10019C9A8: __ubsan_handle_nonnull_return_v1 (in /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/9.0.0/lib/darwin/libclang_rt.asan_osx_dynamic.dylib)
==22900== by 0x10017DC0D: wrap__Znam (in /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/9.0.0/lib/darwin/libclang_rt.asan_osx_dynamic.dylib)
==22900== by 0x1001764DF: __sanitizer_annotate_contiguous_container (in /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/9.0.0/lib/darwin/libclang_rt.asan_osx_dynamic.dylib)
==22900== by 0x101411846: map_images_nolock (in /usr/lib/libobjc.A.dylib)
==22900== by 0x101424FE8: objc_object::sidetable_retainCount() (in /usr/lib/libobjc.A.dylib)
==22900== by 0x10003E03B: dyld::notifyBatchPartial(dyld_image_states, bool, char const* (*)(dyld_image_states, unsigned int, dyld_image_info const*), bool, bool) (in /usr/lib/dyld)
==22900== by 0x10003E255: dyld::registerObjCNotifiers(void (*)(unsigned int, char const* const*, mach_header const* const*), void (*)(char const*, mach_header const*), void (*)(char const*, mach_header const*)) (in /usr/lib/dyld)
==22900== by 0x10105F00A: _dyld_objc_notify_register (in /usr/lib/system/libdyld.dylib)
==22900==
==22900== Conditional jump or move depends on uninitialised value(s)
==22900== at 0x10018CFAD: __sanitizer::StackDepotReverseMap::StackDepotReverseMap() (in /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/9.0.0/lib/darwin/libclang_rt.asan_osx_dynamic.dylib)
==22900== by 0x10018508D: __sanitizer::RegisterCommonFlags(__sanitizer::FlagParser*, __sanitizer::CommonFlags*) (in /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/9.0.0/lib/darwin/libclang_rt.asan_osx_dynamic.dylib)
==22900== by 0x10019C6DE: handleFunctionTypeMismatch(__ubsan::FunctionTypeMismatchData*, unsigned long, __ubsan::ReportOptions) (in /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/9.0.0/lib/darwin/libclang_rt.asan_osx_dynamic.dylib)
==22900== by 0x10019B2E6: handleShiftOutOfBoundsImpl(__ubsan::ShiftOutOfBoundsData*, unsigned long, unsigned long, __ubsan::ReportOptions) (in /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/9.0.0/lib/darwin/libclang_rt.asan_osx_dynamic.dylib)
==22900== by 0x10019C9A8: __ubsan_handle_nonnull_return_v1 (in /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/9.0.0/lib/darwin/libclang_rt.asan_osx_dynamic.dylib)
==22900== by 0x10017DC0D: wrap__Znam (in /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/9.0.0/lib/darwin/libclang_rt.asan_osx_dynamic.dylib)
==22900== by 0x1001764DF: __sanitizer_annotate_contiguous_container (in /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/9.0.0/lib/darwin/libclang_rt.asan_osx_dynamic.dylib)
==22900== by 0x101411846: map_images_nolock (in /usr/lib/libobjc.A.dylib)
==22900== by 0x101424FE8: objc_object::sidetable_retainCount() (in /usr/lib/libobjc.A.dylib)
==22900== by 0x10003E03B: dyld::notifyBatchPartial(dyld_image_states, bool, char const* (*)(dyld_image_states, unsigned int, dyld_image_info const*), bool, bool) (in /usr/lib/dyld)
==22900== by 0x10003E255: dyld::registerObjCNotifiers(void (*)(unsigned int, char const* const*, mach_header const* const*), void (*)(char const*, mach_header const*), void (*)(char const*, mach_header const*)) (in /usr/lib/dyld)
==22900== by 0x10105F00A: _dyld_objc_notify_register (in /usr/lib/system/libdyld.dylib)
==22900==
==22900== Invalid read of size 1
==22900== at 0x100120809: __asan::asan_calloc(unsigned long, unsigned long, __sanitizer::BufferedStackTrace*) (in /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/9.0.0/lib/darwin/libclang_rt.asan_osx_dynamic.dylib)
==22900== by 0x100176130: __asan_poison_stack_memory (in /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/9.0.0/lib/darwin/libclang_rt.asan_osx_dynamic.dylib)
==22900== by 0x101414054: freeBuckets(NXHashTable*, int) (in /usr/lib/libobjc.A.dylib)
==22900== by 0x101413F15: _NXHashRehashToCapacity (in /usr/lib/libobjc.A.dylib)
==22900== by 0x101413E50: NXHashInsert (in /usr/lib/libobjc.A.dylib)
==22900== by 0x101413B0D: NXCreateHashTableFromZone (in /usr/lib/libobjc.A.dylib)
==22900== by 0x1014139CE: NXCreateHashTable (in /usr/lib/libobjc.A.dylib)
==22900== by 0x1014138CE: NXCreateMapTableFromZone (in /usr/lib/libobjc.A.dylib)
==22900== by 0x101413878: NXCreateMapTableFromZone (in /usr/lib/libobjc.A.dylib)
==22900== by 0x101412350: __sel_registerName(char const*, int, int) (in /usr/lib/libobjc.A.dylib)
==22900== by 0x101412062: sel_init (in /usr/lib/libobjc.A.dylib)
==22900== by 0x1014119CA: map_images_nolock (in /usr/lib/libobjc.A.dylib)
==22900== Address 0x104a001a0 is 16 bytes before a block of size 24 alloc'd
==22900== at 0x1000CEDB5: malloc_zone_calloc (in /Users/simrossi/.brew/Cellar/valgrind/3.13.0/lib/valgrind/vgpreload_memcheck-amd64-darwin.so)
==22900== by 0x101413E13: NXHashInsert (in /usr/lib/libobjc.A.dylib)
==22900== by 0x101413B0D: NXCreateHashTableFromZone (in /usr/lib/libobjc.A.dylib)
==22900== by 0x1014139CE: NXCreateHashTable (in /usr/lib/libobjc.A.dylib)
==22900== by 0x1014138CE: NXCreateMapTableFromZone (in /usr/lib/libobjc.A.dylib)
==22900== by 0x101413878: NXCreateMapTableFromZone (in /usr/lib/libobjc.A.dylib)
==22900== by 0x101412350: __sel_registerName(char const*, int, int) (in /usr/lib/libobjc.A.dylib)
==22900== by 0x101412062: sel_init (in /usr/lib/libobjc.A.dylib)
==22900== by 0x1014119CA: map_images_nolock (in /usr/lib/libobjc.A.dylib)
==22900== by 0x101424FE8: objc_object::sidetable_retainCount() (in /usr/lib/libobjc.A.dylib)
==22900== by 0x10003E03B: dyld::notifyBatchPartial(dyld_image_states, bool, char const* (*)(dyld_image_states, unsigned int, dyld_image_info const*), bool, bool) (in /usr/lib/dyld)
==22900== by 0x10003E255: dyld::registerObjCNotifiers(void (*)(unsigned int, char const* const*, mach_header const* const*), void (*)(char const*, mach_header const*), void (*)(char const*, mach_header const*)) (in /usr/lib/dyld)
==22900==
=================================================================
==22900==ERROR: AddressSanitizer: attempting free on address which was not malloc()-ed: 0x000104a001b0 in thread T0
==22900== Conditional jump or move depends on uninitialised value(s)
==22900== at 0x10018CFAD: __sanitizer::StackDepotReverseMap::StackDepotReverseMap() (in /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/9.0.0/lib/darwin/libclang_rt.asan_osx_dynamic.dylib)
==22900== by 0x10019BFCC: handleFloatCastOverflow(void*, unsigned long, __ubsan::ReportOptions) (in /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/9.0.0/lib/darwin/libclang_rt.asan_osx_dynamic.dylib)
==22900== by 0x10019BAA1: __ubsan_handle_missing_return (in /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/9.0.0/lib/darwin/libclang_rt.asan_osx_dynamic.dylib)
==22900== by 0x100193D74: __sanitizer_reset_coverage (in /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/9.0.0/lib/darwin/libclang_rt.asan_osx_dynamic.dylib)
==22900== by 0x10019AEA9: handleShiftOutOfBoundsImpl(__ubsan::ShiftOutOfBoundsData*, unsigned long, unsigned long, __ubsan::ReportOptions) (in /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/9.0.0/lib/darwin/libclang_rt.asan_osx_dynamic.dylib)
==22900== by 0x10019A827: handleNegateOverflowImpl(__ubsan::OverflowData*, unsigned long, __ubsan::ReportOptions) (in /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/9.0.0/lib/darwin/libclang_rt.asan_osx_dynamic.dylib)
==22900== by 0x100128188: __asan::ErrorStringFunctionMemoryRangesOverlap::Print() (in /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/9.0.0/lib/darwin/libclang_rt.asan_osx_dynamic.dylib)
==22900== by 0x10017B5C0: __asan::SetMallocContextSize(unsigned int) (in /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/9.0.0/lib/darwin/libclang_rt.asan_osx_dynamic.dylib)
==22900== by 0x10017A70C: __asan::AsanInitInternal() (in /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/9.0.0/lib/darwin/libclang_rt.asan_osx_dynamic.dylib)
==22900== by 0x100176130: __asan_poison_stack_memory (in /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/9.0.0/lib/darwin/libclang_rt.asan_osx_dynamic.dylib)
==22900== by 0x101414054: freeBuckets(NXHashTable*, int) (in /usr/lib/libobjc.A.dylib)
==22900== by 0x101413F15: _NXHashRehashToCapacity (in /usr/lib/libobjc.A.dylib)
==22900==
==22900== Conditional jump or move depends on uninitialised value(s)
==22900== at 0x10019C1E7: handleFloatCastOverflow(void*, unsigned long, __ubsan::ReportOptions) (in /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/9.0.0/lib/darwin/libclang_rt.asan_osx_dynamic.dylib)
==22900== by 0x10019BAA1: __ubsan_handle_missing_return (in /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/9.0.0/lib/darwin/libclang_rt.asan_osx_dynamic.dylib)
==22900== by 0x100193D74: __sanitizer_reset_coverage (in /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/9.0.0/lib/darwin/libclang_rt.asan_osx_dynamic.dylib)
==22900== by 0x10019AEA9: handleShiftOutOfBoundsImpl(__ubsan::ShiftOutOfBoundsData*, unsigned long, unsigned long, __ubsan::ReportOptions) (in /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/9.0.0/lib/darwin/libclang_rt.asan_osx_dynamic.dylib)
==22900== by 0x10019A827: handleNegateOverflowImpl(__ubsan::OverflowData*, unsigned long, __ubsan::ReportOptions) (in /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/9.0.0/lib/darwin/libclang_rt.asan_osx_dynamic.dylib)
==22900== by 0x100128188: __asan::ErrorStringFunctionMemoryRangesOverlap::Print() (in /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/9.0.0/lib/darwin/libclang_rt.asan_osx_dynamic.dylib)
==22900== by 0x10017B5C0: __asan::SetMallocContextSize(unsigned int) (in /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/9.0.0/lib/darwin/libclang_rt.asan_osx_dynamic.dylib)
==22900== by 0x10017A70C: __asan::AsanInitInternal() (in /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/9.0.0/lib/darwin/libclang_rt.asan_osx_dynamic.dylib)
==22900== by 0x100176130: __asan_poison_stack_memory (in /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/9.0.0/lib/darwin/libclang_rt.asan_osx_dynamic.dylib)
==22900== by 0x101414054: freeBuckets(NXHashTable*, int) (in /usr/lib/libobjc.A.dylib)
==22900== by 0x101413F15: _NXHashRehashToCapacity (in /usr/lib/libobjc.A.dylib)
==22900== by 0x101413E50: NXHashInsert (in /usr/lib/libobjc.A.dylib)
==22900==
atos cannot load symbols for process 22900.
==22900==WARNING: Can't read from symbolizer at fd 5
atos cannot load symbols for process 22900.
==22900==WARNING: Can't read from symbolizer at fd 5
atos cannot load symbols for process 22900.
==22900==WARNING: Can't read from symbolizer at fd 5
atos cannot load symbols for process 22900.
==22900==WARNING: Can't read from symbolizer at fd 5
==22900==WARNING: Failed to use and restart external symbolizer!
#0 0x100176066 in wrap_free (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/9.0.0/lib/darwin/libclang_rt.asan_osx_dynamic.dylib:x86_64h+0x59066)
atos cannot load symbols for process 22900.
#1 0x101414054 in freeBuckets(NXHashTable*, int) (/usr/lib/libobjc.A.dylib:x86_64h+0x4054)
#2 0x101413f15 in _NXHashRehashToCapacity (/usr/lib/libobjc.A.dylib:x86_64h+0x3f15)
#3 0x101413e50 in NXHashInsert (/usr/lib/libobjc.A.dylib:x86_64h+0x3e50)
#4 0x101413b0d in NXCreateHashTableFromZone (/usr/lib/libobjc.A.dylib:x86_64h+0x3b0d)
#5 0x1014139ce in NXCreateHashTable (/usr/lib/libobjc.A.dylib:x86_64h+0x39ce)
#6 0x1014138ce in NXCreateMapTableFromZone (/usr/lib/libobjc.A.dylib:x86_64h+0x38ce)
#7 0x101413878 in NXCreateMapTable (/usr/lib/libobjc.A.dylib:x86_64h+0x3878)
#8 0x101412350 in __sel_registerName(char const*, int, int) (/usr/lib/libobjc.A.dylib:x86_64h+0x2350)
#9 0x101412062 in sel_init (/usr/lib/libobjc.A.dylib:x86_64h+0x2062)
#10 0x1014119ca in map_images_nolock (/usr/lib/libobjc.A.dylib:x86_64h+0x19ca)
#11 0x101424fe8 in map_images (/usr/lib/libobjc.A.dylib:x86_64h+0x14fe8)
#12 0x10003e03b (<unknown module>)
#13 0x10003e255 (<unknown module>)
#14 0x10105f00a in _dyld_objc_notify_register (/usr/lib/system/libdyld.dylib:x86_64+0x300a)
#15 0x101411074 in _objc_init (/usr/lib/libobjc.A.dylib:x86_64h+0x1074)
#16 0x100ff268d in _os_object_init (/usr/lib/system/libdispatch.dylib:x86_64+0x168d)
#17 0x100ff263a in libdispatch_init (/usr/lib/system/libdispatch.dylib:x86_64+0x163a)
#18 0x100f069d5 in libSystem_initializer (/usr/lib/libSystem.B.dylib:x86_64+0x19d5)
#19 0x10004ea1a (<unknown module>)
#20 0x10004ec1d (<unknown module>)
#21 0x10004a4a9 (<unknown module>)
#22 0x10004a440 (<unknown module>)
#23 0x100049523 (<unknown module>)
#24 0x1000495b8 (<unknown module>)
#25 0x10003b433 (<unknown module>)
#26 0x10003f8c5 (<unknown module>)
#27 0x10003a248 (<unknown module>)
#28 0x10003a035 (<unknown module>)
Address 0x000104a001b0 is a wild pointer.
SUMMARY: AddressSanitizer: bad-free (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/9.0.0/lib/darwin/libclang_rt.asan_osx_dynamic.dylib:x86_64h+0x59066) in wrap_free
==22900== Invalid read of size 4
==22900== at 0x101416E7A: class_createInstance (in /usr/lib/libobjc.A.dylib)
==22900== by 0x100FF276A: _os_object_alloc_realized (in /usr/lib/system/libdispatch.dylib)
==22900== by 0x1013C8A73: xpc_dictionary_create (in /usr/lib/system/libxpc.dylib)
==22900== by 0x1013CC0AD: _bootstrap_create_request (in /usr/lib/system/libxpc.dylib)
==22900== by 0x1013CBE6E: bootstrap_look_up3 (in /usr/lib/system/libxpc.dylib)
==22900== by 0x1013CBE10: bootstrap_look_up2 (in /usr/lib/system/libxpc.dylib)
==22900== by 0x101348A81: ___notify_lib_init_block_invoke (in /usr/lib/system/libsystem_notify.dylib)
==22900== by 0x100FF28FB: _dispatch_client_callout (in /usr/lib/system/libdispatch.dylib)
==22900== by 0x100FF28B8: dispatch_once_f (in /usr/lib/system/libdispatch.dylib)
==22900== by 0x1013454F1: _notify_lib_init (in /usr/lib/system/libsystem_notify.dylib)
==22900== by 0x101346386: notify_register_check (in /usr/lib/system/libsystem_notify.dylib)
==22900== by 0x1013A4448: _os_trace_prefs_and_mode_refresh_slow (in /usr/lib/system/libsystem_trace.dylib)
==22900== Address 0x10 is not stack'd, malloc'd or (recently) free'd
==22900==
ASAN:DEADLYSIGNAL
AddressSanitizer: nested bug in the same thread, aborting.
==22900==
==22900== HEAP SUMMARY:
==22900== in use at exit: 208 bytes in 7 blocks
==22900== total heap usage: 7 allocs, 0 frees, 208 bytes allocated
==22900==
[1] 22900 killed valgrind --leak-check=yes ./tmpsh
最佳答案
我使用 -g -fsanitize=address
标志进行编译。删除 -fsanitize=address
完成了这项工作,并允许我正确使用 valgrind。
如果您有任何解释,请随时添加详细信息。
关于C、Valgrind 自由,因为没有任何 malloc 的大量分配,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55637022/
#include using namespace std; class C{ private: int value; public: C(){ value = 0;
这个问题已经有答案了: What is the difference between char a[] = ?string?; and char *p = ?string?;? (8 个回答) 已关闭
关闭。此题需要details or clarity 。目前不接受答案。 想要改进这个问题吗?通过 editing this post 添加详细信息并澄清问题. 已关闭 7 年前。 此帖子已于 8 个月
除了调试之外,是否有任何针对 c、c++ 或 c# 的测试工具,其工作原理类似于将独立函数复制粘贴到某个文本框,然后在其他文本框中输入参数? 最佳答案 也许您会考虑单元测试。我推荐你谷歌测试和谷歌模拟
我想在第二台显示器中移动一个窗口 (HWND)。问题是我尝试了很多方法,例如将分辨率加倍或输入负值,但它永远无法将窗口放在我的第二台显示器上。 关于如何在 C/C++/c# 中执行此操作的任何线索 最
我正在寻找 C/C++/C## 中不同类型 DES 的现有实现。我的运行平台是Windows XP/Vista/7。 我正在尝试编写一个 C# 程序,它将使用 DES 算法进行加密和解密。我需要一些实
很难说出这里要问什么。这个问题模棱两可、含糊不清、不完整、过于宽泛或夸夸其谈,无法以目前的形式得到合理的回答。如需帮助澄清此问题以便重新打开,visit the help center . 关闭 1
有没有办法强制将另一个 窗口置于顶部? 不是应用程序的窗口,而是另一个已经在系统上运行的窗口。 (Windows, C/C++/C#) 最佳答案 SetWindowPos(that_window_ha
假设您可以在 C/C++ 或 Csharp 之间做出选择,并且您打算在 Windows 和 Linux 服务器上运行同一服务器的多个实例,那么构建套接字服务器应用程序的最明智选择是什么? 最佳答案 如
你们能告诉我它们之间的区别吗? 顺便问一下,有什么叫C++库或C库的吗? 最佳答案 C++ 标准库 和 C 标准库 是 C++ 和 C 标准定义的库,提供给 C++ 和 C 程序使用。那是那些词的共同
下面的测试代码,我将输出信息放在注释中。我使用的是 gcc 4.8.5 和 Centos 7.2。 #include #include class C { public:
很难说出这里问的是什么。这个问题是含糊的、模糊的、不完整的、过于宽泛的或修辞性的,无法以目前的形式得到合理的回答。如需帮助澄清此问题以便重新打开它,visit the help center 。 已关
我的客户将使用名为 annoucement 的结构/类与客户通信。我想我会用 C++ 编写服务器。会有很多不同的类继承annoucement。我的问题是通过网络将这些类发送给客户端 我想也许我应该使用
我在 C# 中有以下函数: public Matrix ConcatDescriptors(IList> descriptors) { int cols = descriptors[0].Co
我有一个项目要编写一个函数来对某些数据执行某些操作。我可以用 C/C++ 编写代码,但我不想与雇主共享该函数的代码。相反,我只想让他有权在他自己的代码中调用该函数。是否可以?我想到了这两种方法 - 在
我使用的是编写糟糕的第 3 方 (C/C++) Api。我从托管代码(C++/CLI)中使用它。有时会出现“访问冲突错误”。这使整个应用程序崩溃。我知道我无法处理这些错误[如果指针访问非法内存位置等,
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 我们不允许提问寻求书籍、工具、软件库等的推荐。您可以编辑问题,以便用事实和引用来回答。 关闭 7 年前。
已关闭。此问题不符合Stack Overflow guidelines 。目前不接受答案。 要求我们推荐或查找工具、库或最喜欢的场外资源的问题对于 Stack Overflow 来说是偏离主题的,因为
我有一些 C 代码,将使用 P/Invoke 从 C# 调用。我正在尝试为这个 C 函数定义一个 C# 等效项。 SomeData* DoSomething(); struct SomeData {
这个问题已经有答案了: Why are these constructs using pre and post-increment undefined behavior? (14 个回答) 已关闭 6
我是一名优秀的程序员,十分优秀!