Slashdot Mirror


C# Memory Leak Torpedoed Princeton's DARPA Chances

nil0lab writes "In a case of 20/20 hindsight, Princeton DARPA Grand Challenge team member Bryan Cattle reflects on how their code failed to forget obstacles it had passed. It was written in Microsoft's C#, which isn't supposed to let you have memory leaks. 'We kept noticing that the computer would begin to bog down after extended periods of driving. This problem was pernicious because it only showed up after 40 minutes to an hour of driving around and collecting obstacles. The computer performance would just gradually slow down until the car just simply stopped responding, usually with the gas pedal down, and would just drive off into the bush until we pulled the plug. We looked through the code on paper, literally line by line, and just couldn't for the life of us imagine what the problem was.'"

109 of 560 comments (clear)

  1. I'll show you mine if you.. by king-manic · · Score: 4, Funny

    I'll show you my perpetual motion machines if you show me your perfect autonomous garbage collector. You go first.

    --
    "There are more things in heaven and earth, Horatio, than are dreamt of in your philosophy."
    1. Re:I'll show you mine if you.. by El+Lobo · · Score: 5, Insightful
      The problem was not the garbage collector if you read TFA. The articule is just a shameless plug, some ad spam for some very obscure profile.

      This just tells us once again that our wonderful editors on /. don't even try to understand what's behind an article, but they just find some sensationalistic title (the more AntiMS, the better) and done. This results in more comments of the type... "See, M$ id teh SuCkS", or "thanks god for my Linuzzz."..., so they got more profit for their /. ads (oh, the irony often MS ads, BTW).

      Yellow press..... yes, I know, /. is not supposed to have any credibility like any other parasite news sites, but anyway....

      --
      It's time to realise that Abble's products are the biggest abomination these days. Just say NO to the dumb iAbble way!!
    2. Re:I'll show you mine if you.. by Anonymous Coward · · Score: 5, Informative

      It's not the garbage collector's fault. If an object is still in use, it can't be collected and destroyed. Managed memory only prevents the kind of memory leak where the programmer "loses" all references to the memory and thus never frees it. It also prevents the kind of bug where memory which is still in use is freed. Programs usually crash when that happens (either the OS terminates them due to a memory protection violation or they overwrite their own data and crash later on). That is also what would likely have happened in this case if it weren't for managed memory, because obviously the programmers mistakenly thought that these objects were no longer in use, so they would have freed them when they were still handling events.

    3. Re:I'll show you mine if you.. by Anonymous Coward · · Score: 3, Insightful

      Sad story, but it was THEIR fault. The story title "C# Memory Leak ..." is flat out wrong.

      There is no leak in C# per se. They kept a reference to the objects, so the CLR wasn't even supposed to delete them.

      Morons shouldn't be making car software.

    4. Re:I'll show you mine if you.. by WhatAmIDoingHere · · Score: 2, Insightful

      Slashdot is a blog not a news source. I wish more people would realize that.

      --
      Not a Twitter sockpuppet... but I wish I was.
    5. Re:I'll show you mine if you.. by astrosmash · · Score: 2, Interesting

      It really has nothing to do with running out of memory. Their event dispatcher needs to notify a rapidly increasing number of listeners for each event, and eventually cannot keep up. Hence, their system slows over time and eventually stops.

      A moderately experienced programmer would recognize the problem very easily by, say, noticing that a listener method is getting called 100,000 times for each event.

      --
      ENDUT! HOCH HECH!
    6. Re:I'll show you mine if you.. by bhima · · Score: 4, Insightful

      Fuck. You are so right. This article is just some advertisement for some obscure profiler.

      However I take exception to your use of the world "Editor". Slashdot does not have Editors. They have guys who accept submissions.
      They don't read The Fucking Articles, They don't check links, The don't edit submissions...

      --
      Nothing in the world is more dangerous than sincere ignorance and conscientious stupidity.
    7. Re:I'll show you mine if you.. by fitten · · Score: 5, Informative

      There's also the issue where you need to explicitly remove your event listeners when you no longer need the object. The listener keeps a reference to the object (via the interface) so even if it goes out of scope or what-have-you, YOU may think you don't have any references to the object but it implicitly does, through the listener you handed to the system. So... if you're using event listeners, make sure you explicitly remove them in your object's destructure... or else you'll end up with a memory 'leak'.

    8. Re:I'll show you mine if you.. by TheRaven64 · · Score: 4, Interesting

      Mod parent up, and anyone doing any AJAX coding pay attention. This is one of the easiest bugs to create in JavaScript. JS is a very powerful language with a Self-like object model which a lot of people seem to treat as a basic variant. This means that they create closures when they intend to pass function pointers and end up creating large numbers of object references (the closure itself is an object and it retains a lot of references) preventing the garbage collector from doing anything useful. This is particularly common with AJAX where closures are often used for handling asynchronous events (which would be a gorgeous coding style if the syntax were slightly less ugly).

      --
      I am TheRaven on Soylent News
    9. Re:I'll show you mine if you.. by hoppo · · Score: 2

      Typically, I've found that people who default all blame to "the framework" tend to be careless, lazy developers who refuse to admit that the problem resides with their own code.

      While it's unfortunate that you're so tightly bound to Windows when selecting .NET as your platform (although once mono adopts 3.0 it will be viable IMO), the .NET framework itself has been pretty solid. I've been part of some pretty sizable development efforts where .NET was the platform of choice -- everything from server applications to windows GUI applications to web applications -- and in all those projects we have found the platform itself to be quite reliable.

      What impresses me with .NET is it allows you to write truly orthogonal and very testable code. Your generic rant against the great evil Microsoft suggests you don't have the skillset to properly utilize such tools, and then blame your inadequacies on those tools.

    10. Re:I'll show you mine if you.. by larry+bagina · · Score: 5, Funny

      Next you'll be telling me that I'm not a nerd and this stuff doesn't matter!!!

      --
      Do you even lift?

      These aren't the 'roids you're looking for.

    11. Re:I'll show you mine if you.. by WED+Fan · · Score: 5, Insightful

      Slashdot is a blog not a news source. I wish more people would realize that.

      ...

      News for Nerds. Stuff that matters.

      O.K., I'll bite, what part of that line do you not understand? If /. billed itself as a "blog" then I'd understand your point. However, /. is a corporate based, self-billed "News" site. Whether reader submission driven or not, it is a news site. You are wrong. But, thanks for your thoughts.

      --
      Politics is the art of looking for trouble, finding it everywhere, diagnosing it incorrectly and applying the wrong fix.
    12. Re:I'll show you mine if you.. by Blakey+Rat · · Score: 4, Interesting

      Ditto, I submitted an article about an article that was about a survey done of corporations which concluded that corporations would not quickly adopt Vista. (This was before it was released, which frankly is a 'duh'... do corporations quickly do anything IT related?) But anyway... I spent a lot of time and had someone else read over it, attempting to get the *perfect* Slashdot submissions. There were no grammar errors, no spelling errors, the link was directly over the right keywords, etc.

      The Slashdot editor who posted it moved the link so it looked like I was linking to the original study, not the article about the study. It's like they felt compelled to make a change, so they made one even if the change didn't improve the quality of the article.

      I will say that the rest of the text remained unchanged, and really the only problem with the submission is that people who thought they were going to a study were actually going to a newspaper article about a study, but the point is Slashdot editors *do* make changes all the time.

    13. Re:I'll show you mine if you.. by dgatwood · · Score: 2, Interesting

      If you're trying to imply that errors can be made in any language, you're right, but the big difference is that leaks in a manually allocated language like C++ are a heck of a lot easier to find and fix than leaks in a language that tries to be smart and "help" you avoid leaks.

      If you're failing to dispose of an object, look at the places where it should be freed and make sure that it is. Generally, there aren't a lot of these places. If you have a dangling reference, it will show up in the form of a crash. The resulting backtrace will tell you exactly what object contains a dangling reference, at which point you just have to track down why the reference was not cleaned up when the object it referenced was freed.

      By contrast, in a garbage-collected language (or a reference-counted language), you usually don't have the ease of tracking down the dangling references, and even when you do, you rarely have a way to tell the computer "I expect this object to go away when I release it; warn me if it doesn't." As a result, tracking down those last two or three errant references can be a pain in the ass, particularly if you have circularly-referenced structures jacking up your reference counts. It's not always easy to figure out which of the eighty tree-structured objects is being referenced. You might have a reference to a leaf of a tree and the parent links are keeping the tree alive, or you might have a reference to the root and the child links are keeping it alive, or you might have a reference smack in the middle of the rightmost branch and the references bubble up and back down.

      Workarounds like "soft" references don't help, either. At best, you could keep a hard reference to every node in the tree in some enclosing object and use soft references inside it, but this is a pretty hackish workaround. Anything short of that and you are forced to handle the case where your "parent" node can suddenly go away if the last hard reference to the top of tree is released. This is probably not desirable.

      Nothing annoys me as a programmer more than having to deal with garbage collection or reference counting on complex data structures. Above a certain level of complexity, the complexity of managing memory yourself becomes less than the complexity of working around the garbage collection and/or reference counting.

      The best of these schemes, IMHO, is an advisory reference counting algorithm in which you make a habit of incrementing an object's ref counter whenever you add a reference to it and decrementing it when you remove a reference. Combined with manual alloc/free, this gives you the ease of tracking down where those references are, while still giving you the ability to test for references on free and generate a warning that "Object 0x46b32158 is still referenced in three places when freed at utilities.c:866."

      Then, you just have to correlate the crash dump with the warnings and you know -exactly- what is going wrong and where the failure is occurring. Better, because you are choosing when to increase or decrease the reference counts, you can pick and choose which references to count, ignoring references between objects in a data structure like a tree and only considering outside references (the ones you actually care about). You can even do smart tricks like keeping a second reference count on the top node in the tree that indicates a reference to a subtree so that your warnings can be more informative. "Warning: tree 0x23421420 has active external references to child node 0x43298470." And so on.

      The point is that by taking these things out of the hands of the language and keeping them in the hands of the programmer, while the actual programming is slightly more complex, debugging is so much easier that it makes up for that extra complexity in terms of robustness, performance, etc. (at least for programs with a certain level of complexity and longevity). I thus view garbage collection as a tool that is primarily useful for very simple programs and detri

      --

      Check out my sci-fi/humor trilogy at PatriotsBooks.

    14. Re:I'll show you mine if you.. by asills · · Score: 3, Insightful

      This "article" also shows why you don't let college students write productions systems.

      "We set a timer to restart the computer after 40 minutes".

      Wait. What? Really? That's classic programming by accident. "I added one and it started working, so I moved on."

      --
      -- What did Spock find in Kirk's toilet? The captain's log.
    15. Re:I'll show you mine if you.. by JebusIsLord · · Score: 4, Informative

      Its quite clear in the article that they forgot to unregister their "deleted" objects from events. Since they were still registered, they weren't garbage collected. And rightly so. This was THEIR programming mistake, and has nothing to do with a GC bug in C# or any such thing. Fuck slashdot is pissing me off these days... as soon as they see a story that could be spun as "Microsoft screwed up!", they publish it withouth any fact-checking (or even reading the goddamn article!).

      I wonder is MS could sue Slashdot for slander?

      --
      Jeremy
    16. Re:I'll show you mine if you.. by Harald+Paulsen · · Score: 2, Funny

      Or perhaps it is a place where nerds discuss news and stuff that matters.

      --
      Harald
    17. Re:I'll show you mine if you.. by dbIII · · Score: 2, Insightful

      It's sort of a blog from before the word was thought of and not Reuters.

    18. Re:I'll show you mine if you.. by harlows_monkeys · · Score: 2, Interesting

      It also shows why you shouldn't trust Microsoft products for critical work

      Since every other garbage collected language, from every other company, would have had the same problem, how does it show that?

    19. Re:I'll show you mine if you.. by MickDownUnder · · Score: 2, Insightful

      You are right, the wording of this article is extremely misleading.

      There was a memory leak but it was due to their code, not with the Microsoft .NET Framework. Specifically their code was creating objects that were never being garbage collected as they were still being referenced in their code, i.e. they forgot to dispose and unsubscribe from events to objects that were still active. This is a really simple mistake you'd probably find in 40% of newbie programmers C# or Java code. Yes... this sort of problem can occur just as easily in Java (even more easily if you believe Microsoft).

      Now on to flaming slashdot...

      I really think Slashdot should pull articles like these either completely or at least from the front page when they realise they're misleading or factually incorrect.

      This story simply isn't news worthy, it's not even interesting for anyone half competant in .NET development. It reflects really poorly on slashdot and reduces the sight to the quality of your average web blog. In summary it's a waste of everyone's time.

  2. Well, there's your problem! by feepness · · Score: 5, Funny

    We looked through the code on paper, literally line by line, and just couldn't for the life of us imagine what the problem was. This may be the least effective method of debugging in existence.
    1. Re:Well, there's your problem! by johannesg · · Score: 4, Funny

      No no, that would be something along the lines of printing out the code and then throwing darts at the listing to figure out the incorrect line. I hear it is popular in Redmond, although they reputedly use chairs instead of darts.

    2. Re:Well, there's your problem! by maxwell+demon · · Score: 5, Funny

      No no, that would be something along the lines of printing out the code and then throwing darts at the listing to figure out the incorrect line. I hear it is popular in Redmond, although they reputedly use chairs instead of darts. That makes sense: Since chairs are larger than darts, you have a much greater chance to hit the bugs.
      --
      The Tao of math: The numbers you can count are not the real numbers.
    3. Re:Well, there's your problem! by _merlin · · Score: 3, Insightful

      I'm guessing you wanted me to laugh, but in a highly parallel system, going through the code line by line is often the most effective way of finding a problem. When you catch the bug on a running system, you can see the state it's got itself into. But to figure out how it could have got there, you need to read and analyse the code. People are often far too eager to jump into the debugger when critically analysing the code is often a better solution.

      It obviously doesn't work in situations like this where the bug is in the runtime and not the application.

    4. Re:Well, there's your problem! by __aasmho4525 · · Score: 5, Informative

      just to be clear, THE BUG WAS NOT IN THE RUNTIME, not by any stretch.

      there are very clear constructs in place in the language/runtime to allow any object to unregister itself from event registrations it initiated.

      this was VERY MUCH a bug in the end-user software, not the runtime (i've written code almost IDENTICALLY to this and blew lots of time having made this same mistake).

      the only thing the runtime could do to protect the idiot developer (myself included) is automagically make all event references WEAK references, but that has plenty of undesirable side-effects too... in clr, you can do this yourself if you're so inclined... (just like in a JVM)

      cheers.

      Peter

    5. Re:Well, there's your problem! by FreeGamer · · Score: 5, Informative

      It obviously doesn't work in situations like this where the bug is in the runtime and not the application. RTFA. FTFA:

      Though we thought we had cleared all references to old entries in the list, because the objects were still registered as subscribers to an event, they were never getting deleted. We added one line of code to remove the event subscription and, over the next three days, we successfully ran the car for 300 miles through the Mojave desert. As another poster points out, this is just an advert for a profiler, which helps people who use coding practises that they did not initially fully understand. As much as I wanted it to be a bug in the C# runtime, it's just another PEBKAC issue. The /. article introduction was wonderfully ambiguous on this point, if anything it was inflammatory ("C# memory leak"). Poor article selection if you ask me, but it's been many years since the /. editors genuinely cared about the content on this site rather than the number of hits/adclicks.
    6. Re:Well, there's your problem! by DaveAtFraud · · Score: 4, Interesting

      When writing parallel software, you need to treat the interactions between different threads of execution the same way you treat interactions between different code elements. This is a *DESIGN* issue. That's why debuggers aren't usually useful for finding such problems. Debuggers let you find sequential logic errors but rarely give you any insight into state coupling errors that only occur during real-time execution of the program. This is true whether the error occurs between different threads of the same code or different processes of the overall program. For some reason, people are particullarly unable to see such problems between different threads.

      I first ran into this sort of problem in 1983 when working on a CDC mainframe. The only way to find the bug was the line by line analysis method since even compiling the code with debug caused it to run slower and the nature of the problem changed. That's as much detail as I remember.

      I expect to see a lot more of these kinds of errors pop up as multi-core CPUs become more prevalent (true parallel execution) and people continue to assume that they can just crank out code without taking the time to understand the design. I'd also expect the prevalence of multi-core processors to create a demand for more parallelism. If you don't take advantage of the additional cores, your program will only be as fast as if it were on a single core system. If the competition can create a program that uses the additional cores, your program will seem slow.

      Cheers,
      Dave

      --
      They that can give up essential liberty to obtain a little temporary safety deserve neither safety nor liberty.
      Ben
    7. Re:Well, there's your problem! by Bill,+Shooter+of+Bul · · Score: 2, Funny

      I have noted that programs of non-trivial size almost always have bugs in them. The secret to writing parallel code, is to create multiple personalities, one for each thread. Then you just emulate the code in you parallel mind, and its easy to see the problem.

      --
      Well.. maybe. Or Maybe not. But Definitely not sort of.
    8. Re:Well, there's your problem! by Anonymous+Brave+Guy · · Score: 2, Insightful

      I think there's a rite of passage in programming. First, you see a bug and immediately assume your code is right and the compiler is wrong. With a little experience, you learn that it's actually a darn good bet that your code is the thing with the problem. With a lot of experience, you learn that while it's a darn good bet, on rare occasions the compiler really does get it wrong, but that it usually takes a horrendously long, assembly-level debugging session to prove it.

      Much the same is true of the standard library that comes with your programming language, or any high quality third party library you use. Some of these are considerably more robust than others, but usually if it's something thousands of projects are using, it's going to be your project code that's wrong rather than the library.

      --
      If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
    9. Re:Well, there's your problem! by Marcos+Eliziario · · Score: 3, Funny

      Mod myself funny, please.

      --
      Your ad could be here!
    10. Re:Well, there's your problem! by budgenator · · Score: 2, Insightful

      hopefully you programmed things so if the accelerator_actuator object hasn't heard from the speed_control object in a while it returns to an idle mode rather than bizercko autonomus vehicle peddle to the metal mode, like the Princeton guys did.

      --
      Apocalypse Cancelled, Sorry, No Ticket Refunds
    11. Re:Well, there's your problem! by darkpixel2k · · Score: 2

      And since it's Microsoft code your chance of missing a bug is minuscule. *Bada Bing*

      ...and if MS switched to programming in python, you'd even be able to hit white-space and hit bugs.

      --
      There's no place like ::1 (I've completed my transition to IPv6)
    12. Re:Well, there's your problem! by chromatic · · Score: 2, Insightful

      This may sound horrible, but having to actually understand code in order to work with it is a recipe for disaster.

      It seems to me that hiring barely-competent monkeys to maintain software you care about is the real problem.

    13. Re:Well, there's your problem! by smallpaul · · Score: 2, Informative

      First: The bug was not in the runtime. It was a simple programming bug. Second: the bug had nothing to do with parallel processing. It was an object leak due to event handling. The fastest way to solve it would have been to print out the object graph of the program after it had started running and then again after it had "slowed down". They would have seen a particular class of object had become much more numerous over time. That's you're leaker. Memory leaks ARE often easier to track down empirically rather than by just reading the code over. After all, the bug is that the state of the application is in an unwanted state. So why wouldn't you want to characterize the nature of the unwanted state (not just "memory is gone" but "event listener objects are leaking")?

  3. Slashvertisement by shartte · · Score: 5, Informative

    The linked "article" is just a "sponsored review" for a C# profiler...

    1. Re:Slashvertisement by JanusFury · · Score: 5, Interesting

      The sad thing is that Microsoft offers a perfectly servicable profiler for free that can be used on any C# application and is better than most commercial native Win32 profilers...

      --
      using namespace slashdot;
      troll::post();
    2. Re:Slashvertisement by ceeam · · Score: 3, Insightful

      Of course it has nothing to do with differences between "managed code" and native, right?

    3. Re:Slashvertisement by slashdot.org · · Score: 4, Insightful

      Yeah, it's kind of bizarre. I'm not part of the crowd that actually believes the /. people get anything for posting these articles.

      But I do believe that articles written by companies pretending to be written by end-users are not terribly useful and probably shouldn't end up on /.

      I mean, the article clearly states at the top "By Red Gate Software.".

      So where did the "Bryan Cattle reflects on ..." credit come from? Some random line towards the bottom of what appears a highly edited blurb?

      Seriously.

      "One of our team members downloaded the 14-day trial of ANTS Profiler"

      "To our amazement, it was only minutes before we realized that our list of detected obstacles was never getting garbage collected"

      "If Only We Had Used It Earlier..."

      ANTS Profiler helped us fix a problem in minutes that would have taken us weeks to track down. If only we'd thought of it before the competition, we would most likely have finished the entire race and had a chance at the top prize money.

      All this stuff sounds either very naive or very marketing. You choose.

    4. Re:Slashvertisement by WeirdJohn · · Score: 3, Insightful

      The whole 'reboot to fix it' is a methodology that we're going to see more and more of, as students who have only ever been exposed to windows platforms become more and more pervasive.

      Kinda scary when they start writing systems for medical applications, industrial controllers and power supply chain management, let alone nationwide air traffic monitoring or emergency services interactions management.

        "Hang on, we have to reboot our systems every 6 hours in order to manage this natural disaster - You can be advised when the flood waters will peak in about 15 minutes - did you say the bridge is washing away, and your phone lines are about to fall down? Ring us back in 15 minutes after the systems finish rebooting"

    5. Re:Slashvertisement by jmccay · · Score: 5, Insightful
      I think this is just poor code debugging skills. The new garbage collected languages (C# and Java) seem to be creating coders that don't know the basics of debugging. If this was C++, the bug would have shown up when an event occurred and the code called a deleted object. It would have been harder to track down. In any case, I would have added code to analyze the state of the stack and it's objects since it only occurred after the program/car had been running for a while. Also, had it not occurred to them to increase the number of obstacles beyond the "controlled" environment? You can easily write test code to to add a lot of objects into the stack without the use of the car.

      Our cars used an asynchronous event-based code stack written from scratch by us. They wrote their code stack from scratch. They should have modified an existing one that was proven to work. Either way, I think this is a case of sloppy programming. I don't think it is worth mention aside from the case what the closest thing to a memory leak is that you can have. Unfortunately, that too should have come to mind from them. They ruled that out because "most of [their] code is written in garbage-collected C#". Just because a language is garbage collected, it doesn't mean you can just ignore the issues. All reference to the object must be removed for it to be deleted. This is definitely a case of sloppy programming. I would be embarrassed if my name were attached to this.

            Some old Visual Basic programmer jokes come to mind when I read this article. People use to make fun of Visual Basic programmers because it was to easy to write programs in VB. They thought it would produce sloppy code with errors, and other similar things. To some extent, it appears that same case could be made for C#, and to a lesser extent Java. In the end this is simply a case of not stress testing their event stack.
      --
      At the next eco-hypocrisy-meeting, count the private jets used to get to the meeting. Should be interesting to see that
    6. Re:Slashvertisement by Etrigoth · · Score: 2, Informative

      Indeed it's a great piece of code; the only thing that puts people off is it's apparent complexity - the whitepiper that accompanies it, is a bit offputting too...

      I've had my fair share of experience with ANTs and to be honest, it's been useless in my application. We load controls dynamically in an ASP.Net environment and ANTs refuses to profile them. I've been backwards and forwards with their support team, to no avail. In fact the only thing that happened was me blocking their sales rep from emailing asking if I was prepared to make a purchase yet, when it was plainly obvious it didn't work right for us!

      I've had much better experience with, and strongly recommend, the .Net Memory Profiler, from Scitech software.
      It's saved me so much headache :)

      --
      When we remember we are all mad, the mysteries disappear and life stands explained.
    7. Re:Slashvertisement by h4rm0ny · · Score: 4, Insightful


      Agreed. I was a good VB programmer. But my VB experience was an eight-month interval between C++ jobs. I've knocked out minor MS Office applications when needed since then, but that's it. I'm sorry to say that most of the VB programmers I've worked with were very poor engineers. Admittedly I've not worked in VB for wealthy companies whilst I have in C++, so that colours things somewhat. I don't doubt that there are some good VB programmers out there. But in the cases of most of those I worked with, I could very clearly see how VB led them to be poor engineers. The amount of shortcuts and wizards and instances where they would start their program by dragging a form object onto the design panel and dumping form objects onto it was obviously a leading reason for their poor skills. VB *led* them to take this approach. It works for small Excel apps, barely for database front-ends and not well at all for large projects.

      As is common with the lower end of Microsoft products, the selling point is that they make it very easy to do what they think you want to do. The ability of VB to knock out an interactive form with near-zero knowledge of programming has encouraged a lot of colleges to sell people the idea that a ten-week course of dragging and dropping text box objects is programming whilst a lot of cheap or ignorant employers have taken the graduates at their word and plunged them in over their heads.

      VB is a poor language in many ways and not, imo, suited to a large or sophisticated project. But you can find good VB programmers (was one). It's just that it encourages bad ones.

      Oh, the summary is also wrong. C# hasn't started springing leaks. The programmers missed a reference to objects that they were creating and the garbage collection therefore never triggered to unallocate the memory. I don't doubt it's not easy to automate a vehicle to drive any even 9 miles, but this could have been detected with more thorough debugging. At any rate, the article submitter and overseeing editor should be ashamed of twisting this into an anti-Microsoft jab. I'm a Linux programmer. I can tell you that Linux can compete happily without sinking to the level of lies and misinformation.

      --

      Aide-toi, le Ciel t'aidera - Jeanne D'Arc.
    8. Re:Slashvertisement by samkass · · Score: 2, Insightful

      The new garbage collected languages (C# and Java) seem to be creating coders that don't know the basics of debugging.

      An interesting observation. Java is a lot harder to write bugs in and is easier to debug (with more runtime information), so coders spend a lot less time in the debug cycle and therefore get less experience doing it. So should we design our languages to be obtuse and hard to read (ie. C++) or continue trying to design languages that make it harder to get things wrong?

      Java has made some wrong turns in this regard (ie. autoboxing-- I wonder if we can yank that from the language in JDK7), but in general has done a great job of making it difficult to tie that noose for yourself.

      --
      E pluribus unum
    9. Re:Slashvertisement by Ronin+Developer · · Score: 3, Informative

      It might be slashvertisement, but it also speaks a painful truth that many developers seem to forget.

      The company I worked for, in the efforts to get something out the door, deployed a product to a customer site that had a similar flaw (but, not a .Net app). Every hour or so, it would simply lock up. The solution that was proposed was a script to restart the application at a specific interval rather than track down the actual bug itself and fix it. And, like the Princeton team, they underestimated the time interval when the system was put into a real production environment and more users came online.

      In my own work, I wrote NT services that HAD to run 24x7 and were not allowed to crash - especially due to memory leaks. The components we purchased and used, contrary to their marketing ploy, often had memory and resource leaks - we won't even begin to talk about the runtime library that shipped with the compiler.

      I used a variety of freely available memory managers and commercial QA tools to track down most of the "leaks" and fixed them. If I didn't have source to the component in question, I replaced them or rewrote them from scratch taking time to make sure it didn't leak. Guess what? It worked and those applications/services run 24x7 (well, until they restart server for some other reason).

      Moral of the story - if something is critical - take the time to profile your code and use QA tools to find other potential problems BEFORE you deploy.

      RD

    10. Re:Slashvertisement by TargetBoy · · Score: 2, Insightful

      They wrote their code stack from scratch. They should have modified an existing one that was proven to work. Either way, I think this is a case of sloppy programming. I don't think it is worth mention aside from the case what the closest thing to a memory leak is that you can have. Unfortunately, that too should have come to mind from them. They ruled that out because "most of [their] code is written in garbage-collected C#". Just because a language is garbage collected, it doesn't mean you can just ignore the issues. All reference to the object must be removed for it to be deleted. This is definitely a case of sloppy programming. I would be embarrassed if my name were attached to this

      We have to teach every new developer to share and reuse code and generally avoid continually reinventing the wheel because the anti-cheating rules in college keep them from learning it there. They were probably required to create it from scratch. There needs to be an upper level class where students are given projects that are impossible to complete in the allotted time unless they reuse code that is readily available.
    11. Re:Slashvertisement by nametaken · · Score: 2, Insightful


      I'm sure you're a much better programmer than I am, so I have to ask... why does using the form designer makes someone write bad database access? I'm also curious about what makes VB a poor language. I hear this pretty frequently, but have never gotten a honest explanation of why. Personally, I don't think I've ever encountered a task accomplished, or bit of code written in C# that I couldn't easily translate to VB, and vice-versa. Someone once told me there was some limitation on utilizing System.Reflection, but I just haven't encountered any problems yet. Also, don't the both compile to the same runtime language? I've always assumed it was a "6 and one half dozen" situation, and had more to do with syntax preference than anything.

  4. Stupid Slashdot headline by RzUpAnmsCwrds · · Score: 5, Interesting

    This is a stupid, stupid article headline. Of course you can have a memory leak in a managed language! Any Java programmer who's decent understands that.

    It's not C#'s fault. The team had references to the obstacle list (event handlers), which prevented garbage collection. The .NET CLR did its job, just like it was supposed to.

    1. Re:Stupid Slashdot headline by dgun · · Score: 3, Interesting

      Maybe so. But if they explicitly call delete to invoke the garbage collection of an object, would it not be better for the system to destroy the object and then throw an exception when it tried to send an event notification to a non-existing object?

      Furthermore, if delete is called and the garbage collector does not delete the object because it realizes that the object is registered on certain events, would it not be just as easy to then un-register the object for the event? Or at least report it? After all, the GC already went to the trouble of checking to see if the object was registered with an event notification.

      --
      FAQs are evil.
    2. Re:Stupid Slashdot headline by MathFox · · Score: 3, Insightful
      I do think that this "object lifetime" bug is NOT a memory leak, but that does not change the effects (crash) of the system.
      What is interesting is to see that garbage collection changes one class of bugs (forgetting to explicitly deallocate memory) to another one: unintentionally keeping objects around. Princeton's "obstacle object" lifetime policy was stepped upon by a Dotnet library; Java has similar problems in its libraries. For the Princeton car software, an explicit deallocation routine (like in C/C++) would have been easy to implement.

      Problem is that both C/C++ style memory leaks and C#/Java hidden reference bugs usually remain hidden until the system crashes or trashes after some time. It makes them hard to find in the course of ordinary testing.

      --
      extern warranty;
      main()
      {
      (void)warranty;
      }
    3. Re:Stupid Slashdot headline by cnettel · · Score: 4, Interesting

      There is no explicit delete in C#. They may have added something in their framework, or they're just saying that they called delete on the collection where they thought they stored all objects. The GC isn't psychic. (It could be a good thing to ask the GC to delete an object explicitly and get an exception if it's indeed still referenced elsewhere, but that's not possible in C#, or Java for that matter.)

    4. Re:Stupid Slashdot headline by blowdart · · Score: 5, Insightful

      I think you're getting hung up on the method name. There is no standard "delete" function that marks something as unused (dispose on the other hand sort of gets there). The article itself is unclear but I would assume that they were simply deleting the collision objects from a collection of potential hazards. Whilst that would remove the object from the collection itself it is *not* a delete. As references to the object existed elsewhere the object still exists (look ma, no null pointer exceptions) no delete happens. You cannot specifically say to the GC "We're done with this, delete it", the GC sweeps on a regular basis looking for objects with no references.

      Would you really want the GC deciding that just because an object is no longer part of a collection it's safe to unsubscribe it from events and delete it? I know I wouldn't.

    5. Re:Stupid Slashdot headline by slashdot.org · · Score: 5, Insightful

      Of course you can have a memory leak in a managed language! Any Java programmer who's decent understands that.

      Decent programmers might understand that, but let's be honest, it's not like Java (and other GC languages) haven't been presented as if memory leaks were a thing of the past.

      As a matter of fact, some people will probably still claim that it's technically not a memory leak, but instead an object life-span issue.

      What surprises me is that outspoken proponents of managed languages use the garbage collection so often as a good thing, as if now you can be a sloppier programmer and get away with it.

      In reality you have to identify/control the lifespan of objects anyway, so I personally never understood what the big deal is about freeing memory manually. Not to mention that memory leaks in say, C++ code, really aren't that hard to find. The tools have become pretty freakin decent.

      And also not to mention that garbage collection might be handy for memory, but memory is only one of a plethora of resources that can be leaked. And since for many resources it isn't nearly as appropriate to 'lazy' free them, as a programmer you still have to be aware of the allocate/free paradigm. (as just one silly example, it would suck if you wouldn't be able to explicitly close a file, because you can't delete it before it's closed)

      In other words, you are right. Of course you can have memory leaks in garbage collected languages. And I wish people would stop using GC as an argument why languages as Java are so much better to use than C++.

    6. Re:Stupid Slashdot headline by multi+io · · Score: 3, Insightful

      You could just use weak references (does C# support that?) for all references that the event sender uses to reference its event receivers. In that case, as soon as a receiver has been removed from all those "obstacle lists" and all other objects that held references to it, the weak reference would be the only reference pointing to the receiver, which would make the receiver eligible for garbage collection.

    7. Re:Stupid Slashdot headline by gbjbaanb · · Score: 3, Insightful

      And given the level of skill the average programmer has, anything that makes memory leaks less likely (though not impossible) has got to be seen as a good thing. NO! It is not a good thing, if a program slowly leaks memory then it just makes it harder to find the bug. If you have to reboot the app every week because it has a little leak, no-one's going to be bothered (except the users who see it slowly getting slower). If it has to be restarted daily then you're going to be looking to fix the bug.

      It is easy to leak memory in C++, if you don't know what you're doing. Its easy to leak memory in C#/Java if you don't know what you're doing. That the language makes it easy for you to avoid becoming a better programmer is NOT a good thing.

      I have a good analogy - Firefox. I use FF a lot, I like it, but it does tend to increase its memory usage over time, and has been rightly criticised for it. Now, I'm sure the 'bug' is an aspect of its design and not a programming bug (and I don't want to start a FF memory discussion - I'm only using it as a real-world example) but just imagine if *every* program was like FF - slowly using more and more RAM over time until you restarted it.

      This is what you're asking for when you say that its ok for the average programmer to use C# because the app will have fewer leaks: you'll get fewer leaks. Not none. If the app leaked like a sieve, it'd be spotted in development/test and fixed; if it leaks slowly enough so it passes an hour's testing in certification, then it'll be shipped - and its you that'll get to find the bug as you use it.
    8. Re:Stupid Slashdot headline by Mr.+Shiny+And+New · · Score: 4, Interesting

      You might not be able to use weak references since they introduce (at least in Java) a layer of indirection. For example, an addListener method usually takes an interface of some kind of Listener, not a WeakReference (to a listener).

      Now, if you have control of the implementation of the object who accepts Listeners you can store them internally in a weak collection, which allows them to be garbage-collected. This would work but may not be what the programmer intends. Actually in a language like Java I'd hazard that usually the programmer wouldn't want that at all: consider an application that listens to UI events. As a programmer I want to be able to stick listeners wherever they are needed and leave them there permanently. If I don't need a pointer to the object, I don't want to keep it around, and thus may not have a reference to the listener EXCEPT in the event-management collection. That's the advantage of GC languages: as soon as the object which creates those events (say, a dialog box) goes away, the objects it refers to have one fewer pointer and may be eligible for GC.

      Anyway, lots of code has issues like this: we had a problem at my work where an Apache taglib was caching some compilation in a cache that would grow for ever. It was a simple code fix to solve that problem, but there was no way for us to even SEE the problem until we ran our application under load in a profiler. Fun fun fun.

    9. Re:Stupid Slashdot headline by porpnorber · · Score: 3, Interesting

      I must apologise in advance if this is a bit of a rant. I have a graduate degree in, well, programming language design, and I find some things close to my field just very upsetting. You wrote:

      "...let's be honest, it's not like Java (and other GC languages) haven't been presented as if memory leaks were a thing of the past.

      "As a matter of fact, some people will probably still claim that it's technically not a memory leak, but instead an object life-span issue.

      "What surprises me is that outspoken proponents of managed languages use the garbage collection so often as a good thing, as if now you can be a sloppier programmer and get away with it.

      "In reality you have to identify/control the lifespan of objects anyway, so I personally never understood what the big deal is about freeing memory manually. Not to mention that memory leaks in say, C++ code, really aren't that hard to find. The tools have become pretty freakin decent."

      Perhaps you write very C++-adapted, boilerplate code. The reason garbage collection is essential in a programming language is that without it (a) you cannot provide a safe implementation of first-class functions, since they implicitly grant indefinite lifespan to arbitrary objects; and (b) you cannot build an abstract data type, whose implementation is hidden from the user, since no matter what other features the language may have, you can always tell whether the type a library has handed you is an automatically managed 'atomic' object, or a 'reference type.'

      But why get so upset about weird advanced programming techniques not coming out quite right?

      Because the kicker is, that to those of us who grew up with garbage collected languages, first class functions and abstract data types are elementary programming techniques. They are the bricks and mortar of which everything else is made. "Data structures + Algorithms," you see. Sure, C++ programmers consider it rocket science and discuss ad nauseum their clever smart pointer techniques and their baroque fifty-line function object implementations (or, if they advocate Boost, their two line function object implementation that requires a five thousand line header file and employs a completely different syntax from everything else they do). That's because they're now used to getting through life with no arms and artificial legs.

      The sense in which garbage collected languages make memory leaks a thing of the past is this: that if you received a non-C++-adapted education, focussed on data structures and algorithms and not the fifty-three (or five thousand and six - they make money, let's invent more) Programming Patterns that help you evade the design flaws of the One True Language, and so you are in the habit of thinking and coding using callbacks, strategy functions, abstract types, state encapsulators - all those basic things that (unless the goal is avoiding the shortcomings of C++) are taught in school, and, indeed, all those things that both functional programming and object oriented programming were invented to make notationally direct, then you can just go ahead and code what you think, and you won't be bitten on the bum. The abstract model of computation comes reasonably close to matching the reality. Without it, you're still tracing through the execution in your mind at every step, because relying on the abstraction itself will get you burned.

      Yes, a competent programmer can adapt. Yes, a competent programmer can think at the level of assembly language and either work out exactly the lifetime of the data, or do a second explicit computation, woven in with the main one, to determine it dynamically. A competent programmer can also deal with a language having divergent notations for data, expressions, statements, type expressions, templates, and type expressions within templates; or to phase of the moon dependent name resolution (templates again!); or to notational 'abstractions' requiring manual instantiation in real implementati

    10. Re:Stupid Slashdot headline by nwbvt · · Score: 3, Informative

      "NO! It is not a good thing, if a program slowly leaks memory then it just makes it harder to find the bug. If you have to reboot the app every week because it has a little leak, no-one's going to be bothered (except the users who see it slowly getting slower). If it has to be restarted daily then you're going to be looking to fix the bug."

      Actually the good companies do debug the slow memory leaks, and the bad ones don't debug the slow ones. Besides, any memory leak in a Java program is possible in a C app, so you are eliminating a class of leaks, not replacing them with harder to find leaks. Thus your entire argument is moot. Furthermore, where are you getting the idea that Java memory leaks are going to be slow while C memory leaks are going to be fast? I've seen slow C memory leaks and fast Java ones. I can think of nothing regarding the nature of garbage collection that would effect the speed of the leak.

      "I have a good analogy - Firefox. I use FF a lot, I like it, but it does tend to increase its memory usage over time, and has been rightly criticised for it. Now, I'm sure the 'bug' is an aspect of its design and not a programming bug (and I don't want to start a FF memory discussion - I'm only using it as a real-world example) but just imagine if *every* program was like FF - slowly using more and more RAM over time until you restarted it."

      First, thats not an analogy, thats an example. Second, Firefox is not an application, at least not in this day and age. Today its a platform for web applications which are just vulnerable to memory leaks as any other. If that cool new javascript app that is running on the page you are loading leaks memory, there really isn't a whole lot Firefox can do.

      Third, I fail to see your point. Do memory leaks suck? Of course. Is it best to get rid of them? Of course. Will garbage collection get rid of memory leaks? Of course not. Will they make the problem any worse? No, any code that leaks in Java will also leak in C. Will it make it better? Of course, there are types of leaks which simply are not possible in Java. Those will be eliminated resulting in fewer leaks (though it is of course impossible to eliminate the completely).

      --
      Mathematics is made of 50 percent formulas, 50 percent proofs, and 50 percent imagination.
  5. no one claims C# prevents wasting memory... by saurik · · Score: 3, Informative

    Just because a language is garbage collected doesn't mean you can't "leak" memory (in the more standard definition of "waste memory over time"), it only means you can't completely lose track of references to objects (which is often used as a more technical definition of "leak"). It is quite common for people coding in such languages to accidentally generate live object structures that are mostly made up of garbage that they should have released their references to. Put another way: these people's program was legitimately claiming memory and never releasing it due to their limited understanding of how event handlers work.

  6. This is not a C# memory leak! by Tim+C · · Score: 5, Informative

    This is a programming error, plain and simple. From TFA:

    Though we thought we had cleared all references to old entries in the list, because the objects were still registered as subscribers to an event, they were never getting deleted.

    So references were held to the objects in two places - the list of encountered obstacles, and the list of event subscribers. They were being removed from the list of encountered obstacles, but not being unsubscribed from the event.

    How do you think event subscription works? Something has to hold a reference to the objects that are subscribed to the event! That thing is going to hold a reference until you unsubscribe the object - it neither knows nor cares about any other list of references you may be maintaining separately, how could it?

    This is a coding error. A subtle, non-obvious one perhaps, but a bug nevertheless. It is not an error in the CLR, and in fact the article never paints it as such. That particular bit of spin is wholly down to the submitter.

  7. Shasdotvertisiment at is best by mariuszbi · · Score: 3, Insightful

    I've RTFA, is wasn't a memory leak caused by C#, is was caused by bad programming. After that,the whole article starts to advertise some obscure profiling tool. Maybe they should should have written the whole thing in C++ and use valgrind instead. Just an ideea...

    1. Re:Shasdotvertisiment at is best by Bill+Dog · · Score: 3, Insightful

      ...the whole thing in C++ and use valgrind instead.

      Or better yet, in C++ and use the RAII idiom. I.e. utilize the power of deterministic destruction, that C# and Java lack, to arrange it so that resources, including but not limited to just memory, are auto-freed. (You *can* run into this same kind of problem using reference-counted smart pointers in C++, but happily much of the time they aren't needed.)

      --
      Attention zealots and haters: 00100 00100
    2. Re:Shasdotvertisiment at is best by HangingChad · · Score: 2, Informative

      I've RTFA, is wasn't a memory leak caused by C#, is was caused by bad programming

      We've had similar trouble trying to build big systems on an MS platform. Stubborn memory leaks that don't seem to have a common cause. It's happened in VB and C#. You can't blame them all on bad programming because we've had similar problems from completely different groups of programmers with varying skill levels. We build mainly web apps and this was a desktop app but their description was strangely familiar.

      It's pretty callous to blame the programmer when they trust garbage collection to do its job. That was one of the big selling points of the whole .NET framework from day one. This great tool that manages memory for you. Like a lot of what MS sells it turned out to me more of a false sense of security.

      --
      That's our life, the big wheel of shit. - The Fat Man, Blue Tango Salvage
  8. Re:As a C kernel programmer... by JanusFury · · Score: 2, Insightful

    It's not as if C doesn't leak memory when you mishandle resources. All these people needed to do was spend 5 minutes with the (free) MS .NET profiler and look at the allocation and GC graphs, and they'd be done.

    --
    using namespace slashdot;
    troll::post();
  9. Re:C# Garbage... by JanusFury · · Score: 2, Informative

    It would have to, because otherwise you could register an anonymous class or other similarly constructed object as an event handler, release all your other references, and the GC would collect it while it still needs to be able to recieve messages. (That, or the GC would unregister the event handler, which would be utterly mysterious to debug if you didn't already know the intricacies of the GC, especially since you have no way of predicting when your event handler is collected).

    This problem is actually less drastic in C#, since you have the ability to instantiate anonymous methods (delegates) instead of anonymous classes when doing event handling, and they have lower overhead. So even if you mess up your resource management, it's still much easier to control your resource usage because you have access to cheaper primitives to work with.

    --
    using namespace slashdot;
    troll::post();
  10. Categorization of Resource Management Issues by mr_mischief · · Score: 3, Funny

    This section totals 15 points.

    Background:

    There are more types of resource leaks than just memory leaks. A memory leak is when your program keeps hold of memory it's not using. An object leak is when your program keeps hold of objects it's not using. A file descriptor leak is when your program fails to reuse the descriptors for files it has closed and will not reopen. Many other types of leaks could be considered.

    Exercises:

      1. Determine which issue this scenario describes.
      2. Figure out which issue can be handled by automatic memory management.
      3. Discuss whether, and if so why, the answers to Exercises 1 and 2 mean there is some conceptual discord between the wording of the scenario and the use of the term "memory leak".

  11. c#? by nekozid · · Score: 3, Interesting

    I don't see why they just didn't write it in C.
    They were using massive cooling systems and having very thorough code reviews, sounds like a perfect reason to use C over C#.

    1. Re:c#? by Ash-Fox · · Score: 2, Insightful

      By not wasting their time with 3 times as many lines of C# code?
      Heh... I've written C# programs that took a lot less lines than the equivalent program in C and vice versa.

      By having a much faster compilation time so tests can be done more quickly?
      Since when is compilation a issue with Microsoft Visual Studio .net? You can literally rewrite the code as the program is running.

      By having free high quality profiling and debugging tools?
      Other than the fact that they didn't know how to use the debuggers that come with Visual Studio .net, I really don't think they would of done any better with the same debuggers writing in C under Visual Studio .net.

      By being forced to think about what their functions actually pass to each other, instead of waving their hands and saying "then a miracle occurs"?
      There are tonnes of libraries in C that do automatically garbage collection, who says they wouldn't of done that in C?

      By having such basic errors fail more quickly, rather than after testing and in the field?
      Seeing how the data is accumulated by how many obstacles avoids at a specific speed. I don't see how using C would make it faster.

      Take your pick. I've done some comparisons for simple programs written in C and in C#, though I'm hardly expert in C#, and seen each of these apply at least once.
      I'm not impressed.
      --
      Change is certain; progress is not obligatory.
  12. only 10KLOC? by basiles · · Score: 4, Interesting

    What surprises me most is the small size of their software, only 10 thousands lines of source code (I think that the average car processor already have these for today's cars -ignition & braking systems-). Given a team of a dozen programmers working for a year, I was expecting at least 50KLOC, or maybe 200KLOC (for example, the GCC compiler is 3MLOC, and the linux kernel has comparable size.)

    Of course memory leaks can happen with garbage collected languages, but these leaks are a little easier to find....

    Maybe they should have coded in a higher level language like Ocaml, Haskell.

    And yes, I'm sure most of an autonomous vehicle software is not low-level drivers, but in the planification & perception tasks. On such tasks, higher-level languages definitely make sense.

    I also did not understood what kind of libraries these teams are using.

    I'm also surprised that it is apparently so easy to get funded to have only 10KLOC inside a car!

    1. Re:only 10KLOC? by dkf · · Score: 3, Insightful

      What surprises me most is the small size of their software, only 10 thousands lines of source code (I think that the average car processor already have these for today's cars -ignition & braking systems-). Given a team of a dozen programmers working for a year, I was expecting at least 50KLOC, or maybe 200KLOC (for example, the GCC compiler is 3MLOC, and the linux kernel has comparable size.) Ah, but that 10kLOC needs to be the right 10k, and not all lines of code are the same (incrementing a variable is quite a bit simpler than calling a complex method). Plus you also don't know how many lines of code they threw away.
      --
      "Little does he know, but there is no 'I' in 'Idiot'!"
    2. Re:only 10KLOC? by comp.sci · · Score: 4, Insightful

      It's amusing to see that there are still people who believe in the old "more lines of code means better performance".
      Seriously, the performance of these cars is amazing, a huge step from just a few years ago. The hard part of this project was certainly not the programming, but the concepts behind the obstacle detection and such. This is not an implementation exercise, but more of an academic experiment to test out new ideas.

      (Nice work on mentioning Haskell to guarantee an upmod btw.)

  13. Hard/weak references for event handlers by djinnn · · Score: 4, Interesting

    I see quite a few comments from C/C++ coders who wonder whether managed memory people know how event handling works. If they knew a little more about managed memory languages, they'd know a reference does not have to be "hard": you can have a reference to an object that does *not* prevent garbage collection.

    So I guess the real question here is whether event handlers should be hard-referenced (as they are here), or just soft/weak referenced...
    From a developer perspective it's quite natural to think that, as long as his code doesn't hold any reference to an object, it should be garbage collectable. If registerEvent() shall hard-reference handlers, documentation should be *very* explicit about it (and the need to unregister a handler for GC to work on it).
    On the other hand, if handlers are not hard-referenced you can no longer register anonymous class event handlers...

    1. Re:Hard/weak references for event handlers by tgd · · Score: 5, Interesting

      Weak references also incur the overhead of a check on every call to ensure the object hasn't been cleaned up. This was sloppy, poorly tested code. The engineers on it made a mistake and caught it too late. It happens.

      The poster of the article was trolling, and not only trolled with the post, managed to get a troll posted to a slashvertisement which was not even trolling.

      Impressive on the part of the person who submitted it, but disappointing considering Taco's comments a few weeks back about articles that are truly nothing but advertisements.

  14. Re:Friends do not let Friends use Windows and Driv by Bob54321 · · Score: 4, Funny

    blue screams of death
    Is that a snuff film?
    --
    :(){ :|:& };:
  15. Nothing new here move along....OH Wait? by Anonymous Coward · · Score: 2, Funny

    Just like most windows machines it bogs down and starts crashing after about 40 minutes of hard use.

  16. Re:As a C kernel programmer... by owlstead · · Score: 2

    In C#, the problem manifests itself as a memory leak. In C/C++ however, you would have freed the memory even while the listeners were still active. Now you have a reference to previously freed memory. I know what I would prefer. The only advantage is that - maybe - the C/C++ error would show up earlier, but the form of the manifestation might vary.

  17. Re:As a C kernel programmer... by cyber-vandal · · Score: 4, Funny

    That's why there are no memory leaks in C/C++ code [/sarcasm]

  18. Re:As a C kernel programmer... by maxwell+demon · · Score: 2, Insightful

    As user of programs written in GCed languages, in my experience usually they are bad memory hogs. And don't tell me that memory is cheap. People constantly forget that we are not any more in the days of DOS, where there was essentially only one program running at any time.

    --
    The Tao of math: The numbers you can count are not the real numbers.
  19. Re:Why MS Windows? by tmarklund · · Score: 2

    That forces everybody involved to use MS Windows
    Yeah, because everyone knows you cannot use C# under Linux.
  20. don't these kids learn anything anymore? by m2943 · · Score: 5, Interesting

    (1) You are supposed to test your software.

    (2) You are particularly supposed to test your software if you send $200k and 1 ton of hardware careening through the street on autonomous real-time control.

    (3) Garbage collectors do not prevent memory leaks.

    (4) Garbage collected systems can be good for building real-time systems, but you need a real-time garbage collector or you need to treat the system as if it didn't have a garbage collector at all.

    What "ruined their chances" was not that they overlooked a memory leak, what ruined their chances was that they didn't know what they were doing.

    1. Re:don't these kids learn anything anymore? by MajorCatastrophe · · Score: 2, Insightful

      What "ruined their chances" was not that they overlooked a memory leak, what ruined their chances was that they didn't know what they were doing.

      Whereas code written by people who "know what they're doing" has zero bugs - ever. Right. And to assert that they didn't test their software is ludicrous.

  21. Re:C# Garbage... by Weedlekin · · Score: 4, Informative

    As is the case with Microsoft's GC, Java's won't delete things that are still being referenced by other things, because it quite reasonably assumes that an object which is referenced by another object that hasn't itself been marked for collection isn't garbage.

    The main problem with garbage collectors (I like GCs, so this isn't a diatribe against them) is that far too many mediocre programmers assume they have a magical ability to know precisely what they want their code to do. The reality of course is that they use algorithms to decide what should be collected, when it should be collected, and how it should be collected, and those who are unfamiliar with the particular strategies that their GC uses can therefore not only write code with more than a few memory leaks, but also code that results in the GC being used so inefficiently that it does vastly more work than would be necessary if the same functionality was implemented in a slightly different way.

    There are plenty of articles about Java memory leaks that can be found by Googling "java memory leaks". Googling "java GC tuning" will produce some useful links to articles containing tips on ensuring that it's not used inefficiently.

    --
    I'm not going to change your sheets again, Mr. Hastings.
  22. Ahahaha! by 19thNervousBreakdown · · Score: 2, Interesting

    This kind of thing makes me so happy. Sure, it's not really a bug in C#, but this is even better, a perfect demonstration of how GC does next to nothing to prevent this type of bug, and instead fools people into complacency while making the bug much more subtle.

    In my opinion there is a proper language level for nearly any task. For kernel programming, drivers, or RT stuff, C. User-level stuff is usually better in C++. Well, I'm a big fan of C++ and more comfortable there so I'll usually extend its range down to some lower-level work and sometimes I'll bang out a quick-and-dirty app or script type thing (lots of user input parsing and other things C++ isn't great at) in it too, even if it could be done better (yes, better as in higher quality) or faster in another language.

    Anyway, although I could be making incredibly wrong assumptions about the nature of the problem, I'm pretty sure that C# wasn't the right language for the job. C# very nicely occupies the space between C++ level languages and scripting languages, but for a problem that involves probably no parsing whatsoever (it shouldn't, anyway), needs to be perfectly stable (in my experience GC apps are buggier, I'm not going to go off on that tangent now and explain, but it's been my experience), and have as deterministic runtime as possible, it's C or a subset of C++ (little to no STL) all the way. This paragraph was brought to you by Lisp.

    This problem was caused by, I'm going to go out on a limb here and say the wrong language choice. If this was C/C++, there would have been a segfault (easy to debug--usually) or the old reference wouldn't have mattered at all. C#'s real strong point, its huge and well-integrated library, probably didn't help them out very much.

    Every programmer who wants to call themselves a real programmer should learn as many languages in as wide a range as possible. Sure, have favorites, but that should mean trying to work in your language's realm, not extending it way beyond its range.

    --
    <xml><I><am><so><damn>Web 2.0</damn></so></am></I></xml>
    1. Re:Ahahaha! by gbjbaanb · · Score: 2, Insightful

      No flame here - I think the issues you describe with C# programmers are to do with the age of the language, no-ones really an expert in it as although its been around a while, its only recently people have started coding 'proper' applications in it.

      Its my experience with it that apps written using it are poor too though. I've been headhunted twice now by companies that rewrote their old apps in this cool, new language only to find that it performed so badly they couldn't sell it. (I used to be a performance engineer/troubleshooter at my last job).

      And its not just C#, its the .NET thing in its entirety. I had a little task to do once that involved taking a dozen DB columns and merging them into 1. No problem, I thought I'd write it in managed C++ (as it was a throwaway oneoff task), and it was easy to write and ran ok on my test DB of 300 rows. When I ran it on the live DB, I calculated it would have taken 13 hours to run through all the half-million rows they had (even after doing every optimisation trick I knew, and cutting the code to the minimum). So I rewrote it in "old-fashioned" OLE-DB and it took 10 minutes.

      I'm not a fan of .NET either.

  23. Another similar Problem... by Raven737 · · Score: 4, Informative

    Well the Event Subscribed 'problem' is well known and makes sense if you think about it. I mean subscribing to an Event means placing a pointer to a delegate of a method in a event subscriber list.. when someone raises that event then each delegate in the list is invoked... so basically it is an implicit reference and hence can prevent the it from being marked for garbage collection.

    However, i had another memory 'leak' problem where the Garbage Collector simply didn't collect in time which caused my application to use more and more memory until it reached the system limit and crashed... i found that simply calling
    GC.Collect();
    GC.GetTotalMemory(true);// (the true 'forces' collection ;)
    once would fix this problem... i though i needed to call it every minute or so... but when calling just once it did SOMETHING that prevented this problem from occurring again.. no idea exactly what.. but it works :)

  24. Swing by Tim+Ward · · Score: 3, Informative

    They can't have had anyone on the team with experience of coding for Swing in Java then - you get these all the time, sometimes hanging tens of megabytes of unwanted GUI objects off a single listener registration, and learn how to spot and fix them.

  25. Designed for safety ? by Ihlosi · · Score: 2, Insightful
    usually with the gas pedal down, and would just drive off into the bush until we pulled the plug.

    Yikes. So these guys have the smarts to make a computer drive a car on its own, but managed to forget some basic safety mechanisms such as a watchdog and other failsafe mechanisms ?

    Geez guys - real world engineering 101: Do not let a computer control anything that might have a remote chance of harming someone without appropriate safety mechanisms.

  26. I think they just learnt something by driddint · · Score: 3, Informative
    They did do testing - (1) above - because they knew there was a problem that they could repeat. They just tried to pretend it wasn't happening.

    ... Because we didn't know why this problem kept appearing at 40 minutes, we decided to set a timer. After 40 minutes, we would stop the car and reboot the computer to restore the performance. ...

    They also didn't pick a very good hack because it didn't leave the car in a safe state when the software broke.

    Lack of practical experience I'd say. A few more events like that and they'll make decent devs one day.

  27. Reference counting by Megane · · Score: 2, Insightful

    I just read TFA and it doesn't give any details. My guess? I just checked, and C# apparently uses reference-count garbage collection. That means that an object will stay around until there are zero references to it. The best way to create an object that will never go away is to create a circular linked list, then delete the reference to the list. All the items refer to each other, but there is nothing else that references them. But any complicated data structure that can have circular references will leak memory.

    A mark-sweep garbage collector will catch this, but at the cost of interrupting the program temporarily to do GC. This isn't exactly friendly to real-time applications.

    So basically this looks like a classic noob blunder. Just because there is "automatic" garbage collection doesn't mean that you can turn your brain off.

    --
    #naabhaprzrag, #sverubfr-000, #agi-fcbafberq, negvpyr[pynff*=' negvpyr-ary-'] { qvfcynl: abar !vzcbegnag; }
    1. Re:Reference counting by noidentity · · Score: 2, Insightful

      I just checked, and C# apparently uses reference-count garbage collection.

      I highly doubt that. Got a link?

    2. Re:Reference counting by pete23 · · Score: 3, Informative

      I just checked, and C# apparently uses reference-count garbage collection. erm... no. the CLR implements a mark-sweep-compact generational GC pretty much like Java's.

      these don't have any problems with circular reference structures - if it can't be reached from a root and marked, it'll get collected.

      still just a blunder, as you say.

      this article should be binned - misleading title and nothing but a puff-piece for a profiler. i much prefer YourKit, incidentally:-)
    3. Re:Reference counting by Etrigoth · · Score: 5, Informative

      Actually, C# doesn't reference count at all, it 'Reference Traces' :)

      Please, let me explain; it's quite sad how often people don't get this ...
      .Net has its block of managed memory, called the Managed heap. It's separated into 3 'generations'. This heap has 2 areas, free space and reserved space, from top to bottom.

      When you allocate and object to the heap, by using the new command (object o = new object();) there is a set of rules? that have to be enforced:

      • Allocation occures in a contigious range of the freespace, that's as big as the size the clr determines the type to be.
      • The order of objects must be in the order of creation
      • There must be no gaps between objects
      • The oldest objects are in the lowest address space

      The GC manages Reference tracing, and this doesn't occur when the object goes out of scope, it actually happens when the Heap is full and you attempt to allocate a new object.

      In something called 'the sweep', the GC goes through each object in the heap to see if it's reachable. To do this it starts with so-called 'roots'. It then traces to see which objects are referenced by these roots.

      A root identifys a storage location, which referes to objects on the managed heap, or objects that are set to null. For example, all of an applications global and static objects are considered to be it's roots. (hence the reason that all C# apps have a static void main).

      When the sweep starts, it assumes that all objects are garbage. So for each root object, it builds up a graph of the objects that root references, and marks them as being live.
      However, if it finds an object that's already in the graph, it stops traversing that path. This is two (massively) increase performance by not scanning the same object twice, and more importantly, it stops you getting into an infinite loop by scanning a circular list.

      The pinch is, it prevent the circumstance that you mentioned!
      Because the strong reference to a linked circular list is gone, the circular list isn't attached to a root object, so it gets disposed. If you don't want it to get dropped, unless it theres a memory shortage, the C# GC also supports something called Weak References, but I'm not going to go into those here as it's headhurting :)

      So once all the roots have been checked and we've got a nice graph of all the objects that are referenced by the live parts of the application somehow, the second stage of GC happens.

      Any objects that haven't been touched by the walk are of course still marked as Garbage. The GC now walks up the heap linearly, looking for contigious groups of garbage which are now considered to be free space. The GC looks for the next live object and moves it to the start of this free space with a good old memcpy :) This ofcourse invalidates all the root pointers, so the GC then updates the points in the root objects.

      So now, we've got rid of all the garbage and our heap is pleasantly compacted; Take that Heap Fragmentation, Kerpow!!
      But, that's not all she wrote of course :)

      Now we're free'd and compacted, the 'nextObjPtr' is moved to the top of the heap. At this point the new object creation that triggered the collection is performed and the new object appears at the top of the heap.

      This is a dramatic over-simplification and I've not attempted to explain finalization or weak references, but it's still good to know this stuff, it helps us as .Net programmers to consider how to write our code properly :)
      The other thing I've not explained is how the Generations work:

      • We create a new object and the CLR realises that Gen0 is full and a sweep occurs.
      • Firstly, before the sweep and trash, Gen0 has the youngest objects that the GC has never seen.
      • Now that the sweep has finished, all the compacted obje
      --
      When we remember we are all mad, the mysteries disappear and life stands explained.
    4. Re:Reference counting by chairthrower · · Score: 2, Interesting

      Can you show me any document that indicates that c# (CLR) objects use reference counting. I find it extremely odd that your comment is moderated insightful.

      MS used gc rather than reference counting in CLR to get around the problem of circular references so prevenlant in COM/ DCOM etc.

      Also this is a classic problem in c# - the event handler holds on to the reference - so you need a dispose() to handle exceptions and explicit removal of refereces. but having recently tried to do something similar in c++ using various combinations of boost::bind siglib and refernce counted pointers its not as a trivial problem to solve in any language.

      for those who say just use a weak reference when you need to for multicast delegate behaviour i would like to see their c++ template code they use to parameterise this kind of functionality. Really I am still looking for a good solution to good event handling in c++ that works well in multithreaded environments, and takes a reasonably modern approach to memory (ie RAII).

  28. weak references by edxwelch · · Score: 2, Informative

    Unintentional object retention. I think that is the official name of the problem. It occurs with managed languges. You have a big application with hunderts of objects referencing each other, it's inevidable that you will forget to null out a reference somewhere. (and by the way this is not exclusively a problem of event handlers, it can happen anywhere).
    The solution it to use weak references.
    When I switched from c++ to java, it seemed very obvious to me that this would happen, I just assumed that all experienced coders were using weak references. Out of curiousity, I asked on the forums how many people use weak references, the answer was "what is a weak reference?". Then I explained it's to prevent weak references, they just laughed at me: "dude, we have a garbage collector, we don't have to worry about memory leaks"

  29. Perpetual motion machine vendors by Dr.+Cody · · Score: 4, Funny

    A funny thing happened with during my co-op this summer:

    I was working at a coal-fired power plant which needed a new pollution control device before 2010. There, I would dig through the literature, and try to find suitable products and operating conditions for this device. Anyway, this involved a lot of meetings, conference calls, and business lunches with the suppliers in question.

    Then there was Joe.

    Joe was our Alstom sales rep: portly, humorless, slow to speak and slower to understand. He was also a devote Utahnian.

    Well, one day, we were killing time while waiting on a conference call, my supervisor left the room, and we started talking about universities. Then he dropped the bomb:

    "In my Senior year, I worked on developing perpetual motion machines."

    My supervisor then reentered the room, and we got back to work. I felt like I'd just seen a dancing frog.

  30. This article is badly Slashdot-spinned. by Jugalator · · Score: 2, Informative

    Just read the CodeProject article to see why:
    - "so it wasn't a memory leak per se"
    - "It was the closest thing to a memory leak that you can have in a "managed" language. "
    - "Unfortunately, our system was seeing and cataloging every bit of tumbleweed and scrub that it could find along the side of the road."

    So they just goofed up.

    The objects didn't get deleted in time, because there were always ( literally ;-) )junk near them in the game, hence not getting garbage collected due to their object detection algorithm.

    Bad Slashdot. Bad Slashdot.

    --
    Beware: In C++, your friends can see your privates!
  31. Wow, how embarassing by TummyX · · Score: 3, Interesting
    If I was one of the team members, I wouldn't want my photo up there next to an article that documents my mediocre programming skills.

    Criticisms of the team aside, I would like to say that neither Java nor C# have made any steps to remedy problems like this with seem to be all too common with inexperienced developers. Both Java and C# need to support attaching to event handles with "weak" handlers. That is, the handler will not hold onto the object which defines the handler (and will automatically deregister itself sometime after the object has been collected). In many cases, there is a need for an object to listen and handle an event from another object, but only whilst the object that is listening is still referenced (with the exception of the reference held by the object firing the event).

    In C#, the (admittedly ugly) way to implement this is to use an anonymous method and a weak reference:

    // Need a weak reference to the current object (we want it collected)
    WeakReference weakRef = new WeakReference(this);
    // Need a local (not field) reference to object that raises the event
    SomeClass someObject = this.SomeObject;
     
    EventHandler eventHandler = null;
     
    eventHandler = delegate
    {
      ThisClass _this = (ThisClass)weakRef.Target;
     
      if (_this == null)
      {
          someObject.SomeEvent -= eventHandler;
          return;
      }
     
      _this.DoSomethingInResponseToEventBecauseWeAreStillAround();
    };
     
    someObject.SomeEvent += eventHandler;
    The "closure" that is created for the anonymous method does not hold a reference to "this" as it does not access any of "this"'s fields or methods unless it's through the weakreference.

    The code has a flaw where the event handler code (only a few bytes to hold the closure) will never deregistered be collected unless the event is fired sometime after the owner object has been collected. This can be fixed by using a NotifyingWeakReference (a weak reference that raises an event when it has been collected).

  32. in the URL by HeroreV · · Score: 4, Insightful

    Slashdot editors are even more pathetic than I thought they were. It's bad enough that they didn't skim through the article, but they apparently didn't even take a look at the URL. Look at this thing:
    http://www.codeproject.com/showcase/IfOnlyWedUsedANTSProfiler.asp
    "IfOnlyWedUsedANTSProfiler"? That didn't raise any flags?

    Of course, I'm trying to assume good faith and not just conclude that the editors knew this was an advertisement, but they sure are making that difficult.

  33. Would this even make it as a story... by fuali · · Score: 2, Insightful

    ...on slash dot if it was written in perl on the linux platform. This is just an oppurtunity for someone to read part of a story, make a snappy title that bashes Microsoft based on the misunderstanding of the technology in an article.

    This is not a c# memory leak, it was a memory leak written in c#. The developers used a commerical tool to find there problem, a trail version even. So how about a title "Commercial Code Profiler Saves the Day For DARPA team"?

    Oh because then it would never be a slash dot article, ugh.

    Developers making a mistake != c# bug

    The IDisposable interface is there for a reason.

  34. Re:Ummm... by 19thNervousBreakdown · · Score: 3, Insightful

    It's the programmer and the language. Give the world's best carpenter a ball-peen hammer and ask him to build you a beautiful armoire, see what happens.

    You can say now that they'll be much further next year, but until then "Which means that the language did the job very nicely" should be "Which would mean that the language did the job very nicely." If you put in a reminder of some sort to come back and say I told you so, I'd be more than happy to eat my words if they continue using C# and place in the top 33%. Hell, I'd even concede that you might be right if they manage the top 50%.

    I say, however, that there is a right language for the job. Sure, there's overlap, but you don't implement your FFT in Perl when the problem is that you need the fastest FFT possible, you don't write a word-processor in assembly, and you don't write anything in Brainfuck even though they're all Turing-complete. Anyone who says you can do anything in any language is trying to justify using their favorite language for absolutely everything.

    --
    <xml><I><am><so><damn>Web 2.0</damn></so></am></I></xml>
  35. Bad Bad article title by simonech · · Score: 3, Insightful

    I usually like /. articles, even the ones against MS, but I cannot just skip over this one:
    if the moderator read the article he would have noticed that the article was an advertisement for the profiler product, not just a review of it (it was written directly by Red Gate).
    Second, the article itself says that they found that the error was in how they coded the application, because they left some reference so the garbage collector didn't trow away the objects.
    This is a really bad article and bad information.

  36. Don't Slashvertise. Ever. by spun · · Score: 4, Insightful

    Come on. Really. What kind of idiot marketer sends in stories like this to Slashdot? We know what happens. First, you get derided mercilessly for trying to sway us with your ridiculously transparent attempt at marketing. Then, the real experts come out and poke holes in everything you've said. Then everyone else chimes in with better (and often free) alternatives. You and your company end up looking like buffoons, and your product ends up looking like utter garbage.

    You may think you're pulling one over on the editors, and maybe you are. But you aren't pulling one over on us, and I think after all these years, the editors know this. So, just don't. Unless your product or service is absolutely bulletproof people here are more likely to shoot it full of holes than rush out and buy it.

    --
    - None can love freedom heartily, but good men; the rest love not freedom, but license. -- John Milton
  37. Team Cornell's AI by vectra14 · · Score: 2, Informative

    I'm from team Cornell, #26. We finished the race (although slowly due to what looks like a buggy throttle controller). C# was used exclusively in our system for the strategic planner. It was also used quite a bit for the behavior/operational systems.

    I'm very much a C++ programmer, and with a strong focus on micros to add to that, so yeah, I was a bit... skeptical.

    At one point in development we did have a "memory leak" issue but it was entirely our fault (while obviously there are no "new"/"delete"'s around, if you don't dereference things then essentially you get a nice "memory leak" with all of the associated symptoms).

    I think that C# really sped up our development time, and, in the end, our car finished. I'm sure that there are other fully valid languages/IDEs/etc, but we happened to be most proficient in MSVS; we tested the crap out of C#'s compiler's performance on our machine for our specific application; we used it and that part of the system performed admirably. C# also let us write numerous support utilities quickly.

    Microsoft may have many faults but I'm pretty sure that C# / the Visual Studio IDE environment as a whole aren't it.

    Princeton seemed to have a number of issues outside of "slowing down" during runs. They completely scrapped their first two qualification runs, ran maybe once, and then left.

    P.S. No, i'm not paid by microsoft or such. Aside from the usual departmental benefits like free copies of MSVS and winXP, we didn't get any kind of sponsorship from them.

  38. The right answer to memory management by Animats · · Score: 2, Informative

    There's actually an accepted safe way to do memory management - reference counts and weak references. That's what both Perl and Python have settled on, and it's worth noting that programmers in those languages seldom have serious memory management problems. In C and C++, one has to obsess on memory management issues, and even in Java and C#, which are garbage collected, it takes more attention than it should.

    Reference counts have the advantage of repeatability - deletion will occur at predictable times. This allows the use of destructors. You can safely use destructors to manage other assets, like windows, open files, network connections, and such.

    Destructors in systems with garbage collection make for an unhappy marriage. Calling a destructor or finalizer from the garbage collector is essentially equivalent to calling it at some random time from another thread. So race conditions are possible. Check out Microsoft's "managed C++" for an attempt to get all the cases for this right. It's not pretty.

    The classic complaint about reference counts is "what about cycles"? There's a simple answer - cycles, that is, loops of strong pointers, are errors. This isn't a severe restriction; it just requires some data structure design. With trees, for example, links towards the leaves are strong pointers, and links towards the root are weak. (I've revised Python's BeautifulSoup HTML parser to work that way; "down" and "forward" links are strong, while "up" and "backwards" links are weak. It took about 20 lines of code and eliminated annoying problems in programs dealing with HTML trees.)

    If you really need a symmetrical circular list, which might happen in, say, a window library with many links between widgets, there's a simple solution. Have all the objects owned by some collection, then use weak pointers between them. When the collection is dropped, all the bits and pieces go away, in a well defined order.

    In Python, you can turn off garbage collection while leaving reference counting active, then list any orphaned cycles at program end for debugging purposes. This is a practical way to program without leaks or garbage collection. It's generally easy to find cycles, because cycles are created by data structure design, not by bugs. So if a program has cycles, it will probably have them every time, and thus they can be found early in debugging. With better language support for debugging, cycles could be caught at the moment of creation, which would make it easy to eliminate them.

    Now if we could get this into a hard-compiled language, we'd have the problem solved. Repeated attempts to bolt reference counting onto C++ via templates have resulted in fragile systems. The fundamental problem is that C++ still requires access to raw pointers to get anything done, and this puts a hole in the protection provided by the reference counting system. It takes language support to make this work right.

  39. Slashdot not a news source? Agree! by KWTm · · Score: 4, Interesting

    Slashdot is a blog not a news source. I wish more people would realize that.
    Agree. It's time to get this out in the open.

    People complain that Slashdot sucks: the headlines are sensationalistic, the editors get commissions based on the number of dupes they post, and articles about 6-month-old events get posted as "news".

    So why do I even bother visiting Slashdot? The answer is two things: the community of posters, and Slashcode moderation.

    The value of Slashdot is in its community. You and I, dear Slashdotters. Our collective mind will pick through the various articles, point out their flaws, expose sensationalist FUD for what it is (and, surprisingly, will do this equally for anti-Linux and anti-MS FUD), debate various trends, and provide a signficantly international (though heavily USA-centric) perspective.

    This value is enhanced by Slashdot's moderating system, so that information and insight can bubble to the top among the mass of inane posts. Metamoderation limits the amount of crack that the moderators can be on.

    So, Slashdot editors, take note! *WE* are the reason we are here. *YOU* are not. Many of us don't even bother to read the articles any more, preferring to soak up the collective wisdom of techies from varying age groups and fields. If you piss us off, and the collective community of Slashdot deteriorates, then there's no reason for me (or others) to keep coming back.

    Think about it.
    --
    404555974007725459910684486621289147856453481154 in hex is "You sank my Battleship?"
    [GPG key in journal]
  40. Actually it's probably our fault by Crazy+Taco · · Score: 2, Insightful

    This just tells us once again that our wonderful editors on /. don't even try to understand what's behind an article, but they just find some sensationalistic title (the more AntiMS, the better) and done.

    I suspect it is the fault of slashdot user base as much as the editors. I bet a lot of users were in the firehose, saw the sensationalist title, etc, and rated it highly. The editor comes in, sees it has a sensationalist title and is now colored read, meaning users really think it is great, and posts it. So yes, the editor may not have read the article, but I'm sure the user base didn't either, at least not until after it got posted.

    --
    Beware of bugs in the above code; I have only proved it correct, not tried it.
  41. Re:Mod Parent Up by BalanceOfJudgement · · Score: 2, Informative

    I thought I'd add:

    The next version of the .NET Framework, 3.0/3.5 uses Weak References by default for almost all event handlers you care about. .NET 3.5 runs on the 2.0 CLR though, so it's simply finally using the weak references provided by the CLR.

    --

    We are the fire that lights our world.. and we are the fire that consumes it.
  42. Bad summary. but obvious FREE solution by Brett+Buck · · Score: 4, Insightful

    Hey, here's a wacky idea that's just crazy enough to work - DON"T USE DYNAMIC MEMORY ALLOCATION! Why in holy hell would someone construct what amount to an embedded real-time system using dynamic memory. Define fixed memory allocations for everything. Run tests. If the memory is insufficient, the program crashes. Then you can see where the program crashes and why. Then you can fix it.

          Just because you *can* do something doesn't mean you should.

              Brett

  43. Slashdot *does* have editors. When I submitted... by nil0lab · · Score: 4, Interesting

    Slashdot has editors. I know this, because the stuff below "nil0lab writes..." is heavily editted from what I actually submitted! In fact, I started my actual submission with something like "in a shameless plug for some code analysis product..."

  44. It's not. I didn't. I was editted! by nil0lab · · Score: 2, Interesting

    I sent this story to slashdot, and I'm not a marketer nor do I have any
    relationship with the product. In fact, I started my submission (which
    was editted, see other comment above) with something like "in a blatant
    plug for some kind of profiling product..."