• tldr (unregistered)

    Wait, did he just copy past that into every file?

    I wouldn’t be surprised if the logs take up more time than the actually application if they are in every file.

    Also FRIST

  • frister (unregistered)

    you just got fristed

  • unsays Amadas (unregistered)

    I liked how he gave a nickname to runtime, runny.

  • Kuli (unregistered)

    He should've called freeWilly() instead.

  • (cs)

    I wonder what response the culprit gave to the question "How much performance improvement did you measure?"

  • (cs) in reply to pjt33
    pjt33:
    I wonder what response the culprit gave to the question "How much performance improvement did you measure?"

    I don't need to measure things. I code by feel.

  • (cs)

    So, did you call newhire.freeJob()?

  • President (unregistered) in reply to ochrist

    runny.toTheHills() && runny.forYourLives()

    And about my daughter, runny.cold()

  • (cs) in reply to ochrist
    ochrist:
    So, did you call newhire.freeJob()?

    Quoted for excellence.

  • Max (unregistered) in reply to ochrist
    ochrist:
    So, did you call newhire.freeJob()?
    Does that return a number of jobs available?
  • Dim (unregistered)

    That's exactly why you need source control. People who used to have their commit reverted tend to understand or leave.

  • in_denial (unregistered) in reply to ochrist

    Surely newHire.release()

  • faoileag (unregistered)

    Or, using the wonderful function from 2013-06-18th WTF:

    changeClass($newHire, $exEmployee);

  • Matthijs (unregistered) in reply to President

    You forgot runny.forestRunny()

  • (cs)

    my->cup(runny.over);

  • Rob (unregistered) in reply to Dim
    Dim:
    That's exactly why you need source control. People who used to have their commit reverted tend to understand or leave.

    You clearly don't read very well. Read the first line slowly to yourself a few times. Maybe it will sink in.

  • Rob (unregistered) in reply to faoileag
    faoileag:
    Or, using the wonderful function from 2013-06-18th WTF:

    changeClass($newHire, $exEmployee);

    We're sexing employees now? Isn't that harassment?

  • Mike L (unregistered) in reply to ochrist

    Somehow newhire.freeJob()always returns a null.

  • paullik (unregistered)

    Isn't new hires' code supposed to be peer reviewd before commiting it? They get to push whatever changes they want?

    I think the WTF here is at a higher level, altough a new hire that cannot read a paragraph of documentation is bad enough.

  • MrBester (unregistered) in reply to Rob
    Rob:
    faoileag:
    Or, using the wonderful function from 2013-06-18th WTF:

    changeClass($newHire, $exEmployee);

    We're sexing employees now? Isn't that harassment?

    As an old woman who was eavesdropping, I take offence at that.

  • Mike (unregistered)

    Why do people still try to manage their own memory when they have a gc? This baffles me. Assuming the runtime is well written (which at this point I'd give to both java and .Net) the gc is going to know a lot more about memory usage than you do in all but very rare occasions. Ram is there to be used. The gc will free memory when it needs to or when the system is relatively quiet and it won't effect performance. Why worry about that last few MB (which for 99% of systems will be ram that isn't otherwise being used anyways) in exchange for forcing a performance everywhere? I don't get it.

  • Chad Garrett (unregistered) in reply to Rob

    Not in the industry that came up with the expert sex change

  • Anonymouse (unregistered)

    I got some free memory once. I nabbed it from the machine of a colleague 2 desks over while he was on vacation. He never noticed.

    PS: I do like my runtimes a bit runny, too.

  • An person (unregistered)

    This is exactly how my boss works; he finds a function that sounds by name like it might do what he wants, then uses it liberally without actually reading the documentation, or testing that it actually is doing anything useful.

    Then when he finds out it actually isn't working (much further down the line) he rants about how the standard library is buggy :(((

  • drake (unregistered) in reply to MrBester
    MrBester:
    Rob:
    faoileag:
    Or, using the wonderful function from 2013-06-18th WTF:

    changeClass($newHire, $exEmployee);

    We're sexing employees now? Isn't that harassment?

    As an old woman who was eavesdropping, I take offence at that.

    That's it! Fire everyone involved! You too ma'am.

  • noname (unregistered) in reply to An person

    RTFM?

  • It's Pat (unregistered) in reply to Chad Garrett
    Chad Garrett:
    Not in the industry that came up with the expert sex change

    Oh, that site just threw me off completely! And I'd already come up with my new name... Pat!

  • ForFoxSake (unregistered)

    Wow a real story. That's new.

  • (cs) in reply to Max
    Max:
    ochrist:
    So, did you call newhire.freeJob()?
    Does that return a number of jobs available?
    Nope, it returns a pointer to the unemployment office.
  • erat (unregistered)

    I have to say, I like how he commented each instance with "//performace". It's kind of like putting flame stickers on your bike. Of course it's faster. It has flames on it.

  • Gary (unregistered)

    Certainly newHire.gc()

  • (cs) in reply to tldr

    The sad part is that even if he had gotten the name of the method (which is “gc” – hard to remember, right?) right it still wouldn’t have done what he wanted. In Java you can only allocate so much memory that you get an OutOfMemoryError at which point a garbage collection is guaranteed to have occured.

  • Chris P. Peterson (unregistered)

    Stupid Java and their crappy method names. I blame Java and not the new hire! Seriously though, that was a pretty amusing WTF.

  • caffeine (unregistered) in reply to Max
    Max:
    ochrist:
    So, did you call newhire.freeJob()?
    Does that return a number of jobs available?

    At least two. I'd steer clear of Ashton Kutcher though....

  • ¯\(°_o)/¯ I DUNNO LOL (unregistered) in reply to unsays Amadas
    unsays Amadas:
    I liked how he gave a nickname to runtime, runny.
    That's also how he liked his eggs.

    And when he caught a cold (exception?), he had a runny.Nose()

  • A Coward! (unregistered) in reply to Mike

    Ever come across developers who throw everything into a singleton.

    "Garbage collection just doesn't work in Java. I dereferenced the cache but its still in memory."

    "Is it hanging off a singleton?"

    "I dereferenced it"

    "Did you clear the static instance?"

    "I dereferenced it."

    "The referenced to the singleton or the instance?"

    "But java should take care of it."

    Managed languages can do a lot of things but it can't cope with morons.

  • (cs) in reply to Rob
    Rob:
    Dim:
    That's exactly why you need source control. People who used to have their commit reverted tend to understand or leave.

    You clearly don't read very well. Read the first line slowly to yourself a few times. Maybe it will sink in.

    Or perhaps you're the one reading too much into Dim's comment?

  • Dennis (unregistered) in reply to faoileag
    faoileag:
    Or, using the wonderful function from 2013-06-18th WTF:

    changeClass($newHire, $exEmployee);

    Or in defensive programming:

    try { changeClass($newHire, $exEmployee); } catch(ManagersNephewException) { changeClass($self, $exEmployee); }

  • Fred (unregistered) in reply to ochrist

    For the time being, the only thing it'd do would be returning false :P

  • (cs) in reply to Mike L
    Mike L:
    Somehow newhire.freeJob()always returns a null.
    CLOSED: As Specified.
  • (cs)

    Actually the developer has succeeded in failing, because every call to freeMemory() will allocate an 8-byte long (asting memory), which will then be populated by the JVM (wasting CPU cycles), and will finally be discarded.

    Of course I would expect the JRE to detect those method calls as no-ops and exclude them when JITting the code, but still.

    Finally, I hope whoever hired this "developer" was punched into red mist for their ignorance. HTF do you hire someone who doesn't understand how garbage collection and managed runtimes work?

  • (cs) in reply to Mike
    Mike:
    Why do people still try to manage their own memory when they have a gc? This baffles me. Assuming the runtime is well written (which at this point I'd give to both java and .Net) the gc is going to know a lot more about memory usage than you do in all but very rare occasions. Ram is there to be used. The gc will free memory when it needs to or when the system is relatively quiet and it won't effect performance. Why worry about that last few MB (which for 99% of systems will be ram that isn't otherwise being used anyways) in exchange for forcing a performance everywhere? I don't get it.

    Doesn't give an excuse to be blind to memory usage.

    Once had a program look like it's leaking all over.

    Realized someone was keeping track of records in a map which items were never removed from.

    1 gig of memory later...

  • DB (unregistered) in reply to Chad Garrett
    Chad Garrett:
    Not in the industry that came up with the expert sex change

    HAhahahahahahahaa!

  • Aron (unregistered)

    TRWTF is that you can't do using(var bob = new Hire()) { bob.Dispose(); }

  • Richard (unregistered) in reply to paullik
    paullik:
    Isn't new hires' code supposed to be peer reviewd before commiting it? They get to push whatever changes they want?

    I think the WTF here is at a higher level, altough a new hire that cannot read a paragraph of documentation is bad enough.

    The changes are being pushed to source control. Many organizations have a commit-then-review process. Trust that someone you have given access to do the right thing, and revert if necessary. Some places have new hires deploy on day one.

  • trtrwtf (unregistered) in reply to xaade
    xaade:
    Doesn't give an excuse to be blind to memory usage.

    Once had a program look like it's leaking all over.

    Realized someone was keeping track of records in a map which items were never removed from.

    1 gig of memory later...

    Right - your job as the developer is to free up objects that you no longer need, not to tell the machine how to dispose of them.

    Fortunately, the implementation is free to ignore this call, at least in java:

    public static void gc() Runs the garbage collector. Calling this method suggests that the Java virtual machine expend effort toward recycling unused objects in order to make the memory they currently occupy available for quick reuse. When control returns from the method call, the virtual machine has made its best effort to recycle all discarded object

    So in a sane implementation, this is like the "door close" button in the elevator: it's there so the impatient will have something to fiddle with, it doesn't actually do anything under normal circumstances.

  • (cs)

    writeTrace failure?

    Obviously some of the file may have been omitted, but is this homegrown logging?

    Log.writeTrace("Txns built");

    For some reason I expect either a log level as argument or that the method name reflect the log level. First Google results for writeTrace are not in java or major logging libs. Could be worth investigating.

  • fixer (unregistered)

    theAmountOfMemoryWhichIsCurrentlyAvailableForUse { return runny.freememory }

    Fixed.

  • (cs) in reply to paullik
    paullik:
    Isn't new hires' code supposed to be peer reviewd before commiting it? They get to push whatever changes they want?

    I think the WTF here is at a higher level, altough a new hire that cannot read a paragraph of documentation is bad enough.

    I'm guessing he discovered and used this "technique" at school, and brought this "experience" with him to his new job. So TRWTF is his professor(s) who let him get away with it in class.

  • (cs) in reply to trtrwtf
    trtrwtf:
    xaade:
    Doesn't give an excuse to be blind to memory usage.

    Once had a program look like it's leaking all over.

    Realized someone was keeping track of records in a map which items were never removed from.

    1 gig of memory later...

    Right - your job as the developer is to free up objects that you no longer need, not to tell the machine how to dispose of them.

    Fortunately, the implementation is free to ignore this call, at least in java:

    public static void gc() Runs the garbage collector. Calling this method suggests that the Java virtual machine expend effort toward recycling unused objects in order to make the memory they currently occupy available for quick reuse. When control returns from the method call, the virtual machine has made its best effort to recycle all discarded object

    So in a sane implementation, this is like the "door close" button in the elevator: it's there so the impatient will have something to fiddle with, it doesn't actually do anything under normal circumstances.

    On the elevators at the office building where I work, there's no "close door" button, but if you push a floor button (even one that's already lit) and 1) the door is fully open and 2) there's no one standing in the doorway, it actually will cause the door to close immediately instead of waiting several seconds.

Leave a comment on “Running for Free Memory”

Log In or post as a guest

Replying to comment #:

« Return to Article