On 5/19/19 9:45 AM, Andrew Haley wrote: > On 5/18/19 8:45 PM, Hamad Ahmed wrote: >> How do I do that? > > Seriously? Go find the ABI for your processor and find out which > registers are call clobbered. Write a subroutine in assembly language > that zeroes those registers. And actually, you can go one better than that: write a bunch of inline asms that zero all of the registers, one at a time. #define CLOBBER(reg) \ asm volatile("sub %%" #reg ", %%" #reg ::: #reg, "memory") static inline void foo() { CLOBBER(rax); CLOBBER(rbx); CLOBBER(rcx); CLOBBER(rdx); CLOBBER(rbp); CLOBBER(rax); CLOBBER(rsi); CLOBBER(rdi); CLOBBER(r8); CLOBBER(r9); CLOBBER(r10); CLOBBER(r11); CLOBBER(r12); CLOBBER(r13); CLOBBER(r14); CLOBBER(r15); } This will mostly work, I think, but even then it's not 100% guaranteed. But I still think you're making a mistake: garbage collection -- any kind -- is only guaranteed to happen eventually, sometimes only when the system is running low on memory, and if you really need to control storage lifetime in a precise way you have to do so explicitly. -- 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