As it turns out, the memory leaks which I initially blamed on 5.0 also affect 4.1. It’s not stored procedures leaking memory as I initially thought, but server-side prepared statements. The problem was finally worked out by setting useServerPrepStmts=false in the JDBC code, which “fakes” prepared statements on the client side, without any other code changes.
Read MySQL Bug #18300 for more information!
Thanks for your efforts in hunting this down. I am making sure Kostja takes a look at it today.