- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
Frist, if there's anything left to post about once this is cleaned up
Admin
Your comment will be deleted when the universe ends, so no need to worry.
Admin
Of course, the good old "flood" pattern - one of the first recorded patterns at all (although it is somehow omitted from the GOF book).
Admin
One callback to bind them...?
Admin
Sometimes I think certain developers are really into sadism and masochism, too.
Admin
But even the 'flood' pattern had limits - objects that were ARCed survived unto the next generation.
Admin
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.
Admin
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."
Admin
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.
Admin
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.
Admin
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
Admin
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.