Debugging GC warning on repeated allocation of very large block

858 views
Skip to first unread message

Santiago Palladino

unread,
Nov 27, 2015, 10:39:16 AM11/27/15
to Crystal
Hi all!

I'm doing some heavy data-processing tests in Crystal (in particular, github.com/mverzilli/crystalla) and I'm getting this repeated warning from the GC:


GC Warning: Repeated allocation of very large block (appr. size 39493632):

May lead to memory leak and poor performance.


Any ideas on how to debug this, or find the source of this alloc?


Thanks!

Ary Borenszweig

unread,
Nov 27, 2015, 12:25:51 PM11/27/15
to crysta...@googlegroups.com
That happens when you allocate a lot of memory and don't free it. For example this code triggers the same warning:

~~~
x = [] of Array(Int32)
loop do
  x << Array.new(10_000_000, 0)
end
~~~

Boehm GC has a callbacks for warnings, I tried using it and printing the call stack but it's not useful. Can you show the code that's causing the warning?

--
You received this message because you are subscribed to the Google Groups "Crystal" group.
To unsubscribe from this group and stop receiving emails from it, send an email to crystal-lang...@googlegroups.com.
To post to this group, send email to crysta...@googlegroups.com.
Visit this group at http://groups.google.com/group/crystal-lang.
To view this discussion on the web visit https://groups.google.com/d/msgid/crystal-lang/31663035-e49f-4c63-a3f7-5122c192ebad%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Ary Borenszweig         Manas Technology Solutions
[ar.phone]                      5258.5240       #ARY(279)
[us.phone]                      312.612.1050    #ARY(279)
[email]                         aboren...@manas.com.ar
[web]                           www.manas.com.ar

Santiago Palladino

unread,
Nov 27, 2015, 12:35:03 PM11/27/15
to crysta...@googlegroups.com
I found a possible cause, but it is still throwing the warning at random runs. I’ll try to narrow it down and let you know. Thanks!

-- 
Santiago Palladino 
Manas Technology Solutions
[ar.phone] 4796.0232
[us.phone] 312.612.1050
[email] spall...@manas.com.ar
[web] man.as/spl

You received this message because you are subscribed to a topic in the Google Groups "Crystal" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/crystal-lang/aEOCoytMpAk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to crystal-lang...@googlegroups.com.

To post to this group, send email to crysta...@googlegroups.com.
Visit this group at http://groups.google.com/group/crystal-lang.
Reply all
Reply to author
Forward
0 new messages