isAlive() too conservative -- does it cause leaks?
Ömer Sinan Ağacan
omeragacan at gmail.com
Thu Jul 19 10:09:43 UTC 2018
Hi Simon,
Currently isAlive considers all static closures as being alive. The code:
// ignore static closures
//
// ToDo: This means we never look through IND_STATIC, which means
// isRetainer needs to handle the IND_STATIC case rather than
// raising an error.
//
// ToDo: for static closures, check the static link field.
// Problem here is that we sometimes don't set the link field, eg.
// for static closures with an empty SRT or CONSTR_NOCAFs.
//
if (!HEAP_ALLOCED_GC(q)) {
return p;
}
I'd expect this to cause leaks when e.g. key of a WEAK is a static object. Is
this not the case? I think this is easy to fix but I may be missing something
and wanted to ask before investing into it. The idea:
- Evacuate all static objects in evacuate() (including the ones with no SRTs)
(assuming all static objects have a STATIC_FIELD, is this really the case?)
- In isAlive() check if (STATIC_FIELD & static_flag) != 0. If it is then the
object is alive.
Am I missing anything?
Thanks,
Ömer
More information about the ghc-devs
mailing list