# AW:  Re: [RFC] Magic Method that handles unset($object)

- Thread: https://externals.io/message/26896
- Original archive: https://news-web.php.net/php.internals/26896
- Started by Matthias Pigulla on 2006-12-11T09:11:56+00:00
- Messages: 1
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #26896 — Matthias Pigulla — 2006-12-11T09:11:56+00:00

URL: https://externals.io/message/26896#26896

> -----Ursprüngliche Nachricht-----
> Von: Ants Aasma [mailto:ants.aasma@gmail.com] 

> That would indeed be too slow. The standard way to handle 
> this, is to only check visibility periodically. That is how 
> Java, .NET, Python and countless others do that. Check 
> http://www.hpl.hp.com/personal/Hans_Boehm/gc/ for a sample of 
> how an implementation might look like.

The whole issue comes up regularly on various lists, e. g. Propel or Phing suffer from it. Also see http://bugs.php.net/bug.php?id=33595. Working around this in userland may be possible but is at least painful and messy.

If the only problem is that detection is slow, wouldn't it be possible to add a gc_cleanup() function that performs the scan? Those who use PHP in a request/response environment need not care (everything is freed at the end of the request). Those who don't and hit the problem regularly will find a good place to make this call and certainly won't complain about the delay. 

mp.
