Git Product home page Git Product logo

Comments (4)

taigacon avatar taigacon commented on August 16, 2024

All right, maybe gc think the 'aaa' variable is still using in stack. If I put allocation in a independent function, everything is fine.

from bdwgc.

taigacon avatar taigacon commented on August 16, 2024

See that ESP+4 to ESP+12 stores the address unexpectedly. And here is the asm of gc_cleanup::gc_cleanup() in Debug mode.

1
2

from bdwgc.

hboehm avatar hboehm commented on August 16, 2024

My feeling is that this is a judgment call. If there is an easy way to
clean more dead registers or stack locations at minimal cost, then it may
be worth doing. But a conservative collector is never going to guarantee
that "all dead objects" will be collected. Even for a non-conservative GC,
that's a tough notion to define, and Java doesn't try. No code should be
relying on running a finalizer at a certain point.

In this particular case, it's not clear to me there is a cheap/easy
solution. Especially if this only happens in debug mode.

I would generally be more concerned with stack locations that may not be
overwritten for a long time than with registers that might keep an object
live for a single GC.

On Mon, Jan 4, 2016 at 7:32 AM, taigacon [email protected] wrote:

All right, EAX and ECX still hold the address of the latest allocated
object ( in Debug mode ). Shall we clear all the registers before we call
GC_gccollect() ?

β€”
Reply to this email directly or view it on GitHub
#85 (comment).

from bdwgc.

rptb1 avatar rptb1 commented on August 16, 2024

@hboehm writes:

Even for a non-conservative GC, that's a tough notion to define

Indeed. See http://www.memorymanagement.org/glossary/d.html#term-dead

It is not possible, in general, for garbage collectors to determine exactly which objects are dead and which are live. Instead, they use some approximation to detect objects that are provably dead, such as those that are unreachable.

And also http://www.ravenbrook.com/project/mps/master/manual/html/topic/finalization.html#cautions

Don’t rely on finalization for your program to work. Treat it as an optimization that enables the freeing of resources that the garbage collector can prove are unreachable.

This is a message I've been repeating for many years :)

from bdwgc.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.