Hacker News new | ask | show | jobs
by abbiya 2329 days ago
why does php garbage collect anything when there is a reference ? (weakmaps)
2 comments

Right now, it doesn't. If there's a reference, then the item is not garbage collected. The WeakMaps change will allow a developer to take a reference to something but say, "Hey, I'm caching this for now, but if you need the space, I'm not married to it."
It doesn't, unless you specifically tell it that it should ignore a reference by using a weakref or weakmap.