Hello I am experiencing a behavior when using DBI inside Dancer that seems to result on SCALAR leaks, but only when running inside Dancer.
To help diagnosing I did a couple of tests that I try to explain below. First, I developed a sample small application in Dancer. It is available (temporarily) in http://paste.perldancer.org/2yIABT6Yreh5T. Basically, it has two routes. One that calls Devel::Gladiator and dumps the count for each type of variables currently available, and another route that returns OK. This route has a prepare statement (line 27) that is my problem. If I comment that line, and test calling the main route different times (calling the arena between calls) I get the result in http://paste.perldancer.org/sWhBrp2rh1lq. Basically, first 5 hits are discarded, just to make sure all variables and caches prepared by Dancer are filled in, and then I call the main route 100 times. You might notice the amount of scalars rarely changes, and at the end, the summary is negative (less two scalars than the amount we had when beginning the test). If I uncomment, then I get http://paste.perldancer.org/1mjhfOfwxEJxf, where you might notice almost each call increments a SCALAR into memory. At the end, the summary is 97 wasted scalars (almost the same number of hits). Although I imagine DBI does some kind of cache, it is weird it stores 97 copies for the same query. Nevertheless, I tried a similar approach without Dancer, and NO SCALAR gets lost at all. Also, tried to do, in the same route, two prepares, and the number of lost scalars doubles. If I do only one prepare but two execute/fetch, I get only one scalar lost. So, this is something about Dancer and DBI together. But I have no idea of what might be going on. If you need some more details, or that I run some test, please poke me at #dbi on irc.perl.org (ambs). Thanks, Alberto (aka ambs) -- Alberto Simões