How to force gcc to blackhole registers so that things maybe garbage collected?

Andrew Haley aph@redhat.com
Sat May 18 19:24:00 GMT 2019


On 5/17/19 4:04 PM, Andrew Haley wrote:
> Its not the collector’s imprecision that’s the problem here. Boehm
> GC is conservative i.e.  if an integer in the memory looks like a
> pointer to memory then that memory is leaked. The problem here is
> that gcc leaves dead pointers in registers and doesn’t overwrite
> them if there isn’t a lot of register pressure.

I have a suggestion: try writing a function in assembly language that
clears all call-clobbered registers. I reckon this will solve 75% of
your problem.

-- 
Andrew Haley
Java Platform Lead Engineer
Red Hat UK Ltd. <https://www.redhat.com>
https://keybase.io/andrewhaley
EAC8 43EB D3EF DB98 CC77 2FAD A5CD 6035 332F A671



More information about the Gcc-help mailing list