Call Scalar::Util::weaken for avoiding circular references

When using this module (not calling "update") again and again in a program the memory consumption increased.
I investigated and found that there are circular references and the memory regions were not freed.
This patch weakens such references and I confirmed the memory consumption does not change however times I use this module.