>> https://gist.github.com/3059829

> Looking at that program, it seems you build a very large recursive data
> structure and then free it in one go, without providing appropriate stack
> space for this operation, so the segfault just means "out of memory"
> because of the deep recursion.

1000 +- 100 hashes with 3-4 fields in 100 asyncs...
test computer has more than 4G RAM.

also you can watch these segfaults if You reduce iteration count, it
will be rarelly, but they will be.


> As such, the problem has nothing to do with Coro, you are just running out
> of memory (and Coro detects this because it places guard pages at the end
> of stack to catch this problem).

> You can verify that by using gdb to get a backtrace on the crash - most
> likely you will see hundreds of recursions inside sv_free.

by default ulimit -s == 8192, Coro::State::cctx_stacksize == 16384

I've increased these limits upto 3276800000 - the script segfaults.

But If I comment 'weaken' lines (and head pointer in $head variable)
it doesn't crash even if ulimit -s == 8192 /
Coro::State::cctx_stacksize == 16384.

The code that never crashes
https://gist.github.com/3059829#gistcomment-366046

and the code that crashes have the same stack requirements.
Also the second example never crashes if You increase iterations in 10
times: it gets ~2G RAM but it doesn't crash.

So I think that crashes happen if You use 'weaken' in Yur objects.

> If you free large data structures you need to increase the stack space,
> either using ulimit -s and/or using Coro::State::cctx_stacksize. Or change
> your program to use less memory on free.

-- 

. ''`.                               Dmitry E. Oboukhov
: :’  :   email: un...@debian.org jabber://un...@uvw.ru
`. `~’              GPGKey: 1024D / F8E26537 2006-11-21
  `- 1B23 D4F8 8EC0 D902 0555  E438 AB8C 00CF F8E2 6537

Attachment: signature.asc
Description: Digital signature

Reply via email to