Browse thread
Final_tag and garbage collection
- Robbert VanRenesse
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Robbert VanRenesse <rvr@c...> |
| Subject: | Final_tag and garbage collection |
The system that I'm building uses a mixture of C and CAML. Sometimes it is necessary to have references from CAML objects to C objects. When CAML cleans up its objects, the C objects need to be cleaned up as well. I'm using the finalization functionality of CAML for that. However, it only appears to work reliably in combination with alloc_shr(), not with alloc(). Here's the code: value link; link = alloc_shr(3, Final_tag); Field(link, 0) = (value) link_final; ... Very reliably, the function link_final is automatically invoked when the system is garbage collecting. However, if I use alloc() instead, it sometimes happens, but lots of blocks appear to not get finalized. I used all of gc__minor, gc__major, and gc__fullmajor to try to provoke finalization, but only a subset of what I allocated this way gets finalized. Any ideas? Robbert