a garbage collector. But you have to do it when things go wrong. And things
usually go wrong.
-__ https://proj.llucax.com.ar/blog/dgc/blog/post/-288428a1
+__ /blog/blog/post/-288428a1
.. _D: http://www.digitalmars.com/d/
This is a small chronicle about how I managed to debug a weird problem =)
least [#benchapp]_. Dil_ looked like a good candidate so I said *let's use Dil
in the benchmark suite!*.
-.. _`Naive GC`: https://git.llucax.com.ar/w/software/dgc/naive.git
-__ https://proj.llucax.com.ar/blog/dgc/blog/post/37e6cb2a
-.. _micro-benchmarks: https://git.llucax.com.ar/w/software/dgc/dgcbench.git
+.. _`Naive GC`: https://git.llucax.com/w/software/dgc/naive.git
+__ /blog/blog/post/37e6cb2a
+.. _micro-benchmarks: https://git.llucax.com/w/software/dgc/dgcbench.git
.. _Dil: http://code.google.com/p/dil
And I did. But Dil_ didn't work as I expected. Even when running it without
the cell to a multiple of a word`__, but nothing.
.. _Valgrind: http://valgrind.org/
-.. _`gc_malloc()`: https://git.llucax.com.ar/w/software/dgc/naive.git/blob/2d8639409b4749afd92266347f20b99da80e14c9:/gc/gc.d#l502
-__ https://git.llucax.com.ar/w/software/dgc/naive.git/commitdiff/39707a88bed116fbda8c590c9b6ff9193f30f58f
-__ https://git.llucax.com.ar/w/software/dgc/naive.git/commitdiff/39707a88bed116fbda8c590c9b6ff9193f30f58f
+.. _`gc_malloc()`: https://git.llucax.com/w/software/dgc/naive.git/blob/2d8639409b4749afd92266347f20b99da80e14c9:/gc/gc.d#l502
+__ https://git.llucax.com/w/software/dgc/naive.git/commitdiff/39707a88bed116fbda8c590c9b6ff9193f30f58f
+__ https://git.llucax.com/w/software/dgc/naive.git/commitdiff/39707a88bed116fbda8c590c9b6ff9193f30f58f
Since Valgrind_ only detected that problem, which was at the static constructor
of the module ``tango.io.Console``, I though it might be a Tango_ bug, so
``-debug=MEMSTOMP``). That would confirm that the swept memory were still in
use. And it did.
-__ https://git.llucax.com.ar/w/software/dgc/naive.git/commitdiff/bc664a95db5c7bab194f2e64cf96b6f092c5e60c
+__ https://git.llucax.com/w/software/dgc/naive.git/commitdiff/bc664a95db5c7bab194f2e64cf96b6f092c5e60c
__ http://www.dsource.org/projects/tango/browser/tags/releases/0.99.8/lib/gc/basic
The I tried this modified GC with *memory stomp* with my micro-benchmarks_ and
So, the problem should be either my `gc_free()`_ implementation (which is
really simple) or a Dil_ bug.
-.. _`gc_free()`: https://git.llucax.com.ar/w/software/dgc/naive.git/blob/2d8639409b4749afd92266347f20b99da80e14c9:/gc/gc.d#l661
+.. _`gc_free()`: https://git.llucax.com/w/software/dgc/naive.git/blob/2d8639409b4749afd92266347f20b99da80e14c9:/gc/gc.d#l661
In order to get some extra information on where the problem is, I changed the
`Cell.alloc()`_ implementation to use mmap_ to `allocate whole pages`__, one
ing them when they were give back to the program) in order to make Dil_
segfault exactly where the freed memory was used.
-.. _`Cell.alloc()`: https://git.llucax.com.ar/w/software/dgc/naive.git/blob/346f04b3e1026ded5af3ac95a483b2c3d05a6d60:/gc/cell.d#l86
+.. _`Cell.alloc()`: https://git.llucax.com/w/software/dgc/naive.git/blob/346f04b3e1026ded5af3ac95a483b2c3d05a6d60:/gc/cell.d#l86
.. _mmap: http://www.kernel.org/doc/man-pages/online/pages/man2/mmap.2.html
-__ https://git.llucax.com.ar/w/software/dgc/naive.git/commitdiff/cc637a89be9b51945246bd65fa15080464a90aca
+__ https://git.llucax.com/w/software/dgc/naive.git/commitdiff/cc637a89be9b51945246bd65fa15080464a90aca
.. _mprotect: http://www.kernel.org/doc/man-pages/online/pages/man2/mprotect.2.html
I ran Dil_ using strace_ and this is what happened::