You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#include<iostream>
#include"co_context/io_context.hpp"
co_context::task<int> func() { co_return6; }
intmain() {
co_context::io_context ctx;
ctx.co_spawn([]() -> co_context::task<> {
while (true) {
auto x = co_awaitfunc();
std::cout << x << std::endl;
}
}());
ctx.start();
ctx.join();
}
在这种情况下,会发生segmentation fault.
The report of valgrind
==146874==
==146874== Process terminating with default action of signal 11 (SIGSEGV)
==146874== Bad permissions for mapped region at address 0x5474FF8
==146874== at 0x4EE8D40: fwrite (iofwrite.c:31)
==146874==
==146874== HEAP SUMMARY:
==146874== in use at exit: 75,160 bytes in 5 blocks
==146874== total heap usage: 65,501 allocs, 65,496 frees, 3,742,936 bytes allocated
==146874==
==146874== 304 bytes in 1 blocks are possibly lost in loss record 3 of 5
==146874== at 0x4848A13: calloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==146874== by 0x4012CE9: calloc (rtld-malloc.h:44)
==146874== by 0x4012CE9: allocate_dtv (dl-tls.c:375)
==146874== by 0x4012CE9: _dl_allocate_tls (dl-tls.c:634)
==146874== by 0x4EFF259: allocate_stack (allocatestack.c:423)
==146874== by 0x4EFF259: pthread_create@@GLIBC_2.34 (pthread_create.c:652)
==146874== by 0x4CE9438: std::thread::_M_start_thread(std::unique_ptr<std::thread::_State, std::default_deletestd::thread::_State >, void (*)()) (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.32)
==146874== by 0x10DC82: co_context::io_context::start() (in /home/tpa/Heimerdinger-Lab/Karma/build/benchmark/benchmark)
==146874== by 0x10B605: main (in /home/tpa/Heimerdinger-Lab/Karma/build/benchmark/benchmark)
==146874==
==146874== LEAK SUMMARY:
==146874== definitely lost: 0 bytes in 0 blocks
==146874== indirectly lost: 0 bytes in 0 blocks
==146874== possibly lost: 304 bytes in 1 blocks
==146874== still reachable: 74,856 bytes in 4 blocks
==146874== suppressed: 0 bytes in 0 blocks
==146874== Reachable blocks (those to which a pointer was found) are not shown.
==146874== To see them, rerun with: --leak-check=full --show-leak-kinds=all
==146874==
==146874== For lists of detected and suppressed errors, rerun with: -s
==146874== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
[1] 146874 segmentation fault (core dumped) valgrind --leak-check=yes ./benchmark
The text was updated successfully, but these errors were encountered:
在这种情况下,会发生segmentation fault.
The report of valgrind
==146874==
==146874== Process terminating with default action of signal 11 (SIGSEGV)
==146874== Bad permissions for mapped region at address 0x5474FF8
==146874== at 0x4EE8D40: fwrite (iofwrite.c:31)
==146874==
==146874== HEAP SUMMARY:
==146874== in use at exit: 75,160 bytes in 5 blocks
==146874== total heap usage: 65,501 allocs, 65,496 frees, 3,742,936 bytes allocated
==146874==
==146874== 304 bytes in 1 blocks are possibly lost in loss record 3 of 5
==146874== at 0x4848A13: calloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==146874== by 0x4012CE9: calloc (rtld-malloc.h:44)
==146874== by 0x4012CE9: allocate_dtv (dl-tls.c:375)
==146874== by 0x4012CE9: _dl_allocate_tls (dl-tls.c:634)
==146874== by 0x4EFF259: allocate_stack (allocatestack.c:423)
==146874== by 0x4EFF259: pthread_create@@GLIBC_2.34 (pthread_create.c:652)
==146874== by 0x4CE9438: std::thread::_M_start_thread(std::unique_ptr<std::thread::_State, std::default_deletestd::thread::_State >, void (*)()) (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.32)
==146874== by 0x10DC82: co_context::io_context::start() (in /home/tpa/Heimerdinger-Lab/Karma/build/benchmark/benchmark)
==146874== by 0x10B605: main (in /home/tpa/Heimerdinger-Lab/Karma/build/benchmark/benchmark)
==146874==
==146874== LEAK SUMMARY:
==146874== definitely lost: 0 bytes in 0 blocks
==146874== indirectly lost: 0 bytes in 0 blocks
==146874== possibly lost: 304 bytes in 1 blocks
==146874== still reachable: 74,856 bytes in 4 blocks
==146874== suppressed: 0 bytes in 0 blocks
==146874== Reachable blocks (those to which a pointer was found) are not shown.
==146874== To see them, rerun with: --leak-check=full --show-leak-kinds=all
==146874==
==146874== For lists of detected and suppressed errors, rerun with: -s
==146874== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
[1] 146874 segmentation fault (core dumped) valgrind --leak-check=yes ./benchmark
The text was updated successfully, but these errors were encountered: