• i be guest (unregistered)

    Frist, if there's anything left to post about once this is cleaned up

  • my name is missing (unregistered)

    Your comment will be deleted when the universe ends, so no need to worry.

  • (nodebb)

    Of course, the good old "flood" pattern - one of the first recorded patterns at all (although it is somehow omitted from the GOF book).

  • 🤷 (unregistered)

    One callback to bind them...?

  • (nodebb)

    Sometimes I think certain developers are really into sadism and masochism, too.

  • Simon (unregistered) in reply to Kamil Podlesak

    But even the 'flood' pattern had limits - objects that were ARCed survived unto the next generation.

  • Sole Purpose Of Visit (unregistered)

    Not strictly garbage collection, is it? More resource reclamation.

    I'm not defending it. (How the F could I?) I'm just pointing out that there's a bit of Cargo Culting behind this. Memory leaks are so last century (except when they aren't).

    Resource leaks? I doubt they will ever go away. They don't even require a thunk to C/C++/unmanaged whatever.

    A simple connection to a database, left uncommitted, will do it for ya.

  • WTFGuy (unregistered)

    Didn't your Mommy ever tell you to put away the toys you got out? I guess resource leaker devs are are the kids whose parents just followed along after them picking up whatever was heedlessly dropped whenever the kid lost interest in it. "If it's not in my hand or in my mouth it doesn't exist to me."

  • (nodebb)

    Remember a memory leak is when there is a memory allocation that is completely unreachable. Holding onto to objects by some obscure resource when it it totally unnecessary is not a memory leak.

  • Anon (unregistered)

    What's the WTF here? We've all been here before when we were learning to use callbacks back in middle school. The only WTF is that JS frameworks don't make it easier to find bugs like this.

  • (nodebb) in reply to Anon

    I kinda thought the same. To me the real WTF is the method named bind is ambiguous as to whether previously bound methods are evicted. I would personally use clearer names such as: addCallback() <-what it actually seems to do setCallback() <- what the programmer mistook it for

  • gnasher729 (unregistered)

    Back in the days when I worked on a JVM, I wrote a class "MemoryLeak" for educational purpose. You could just write new MemoryLeak(<any object) (sorry but I've worked hard on forgetting Java syntax since), and that object was instantly leaked. It was stuck in the VM in a place where it could not be garbage collected, and could not be accessed in any way. That class was probably about ten or twenty lines of Java.

  • Loansforher (unregistered)
    Comment held for moderation.
  • Everydayloanindia (unregistered)
    Comment held for moderation.

Leave a comment on “Callback Bondage”

Log In or post as a guest

Replying to comment #:

« Return to Article