Live data from Hacker News

Die, You Gravy Sucking Pig Dog

codinghorror.com

21–26 of 26 posts

Re: Die, You Gravy Sucking Pig Dog

#23

Earlier quoted context omitted.

We have to call free when the program shuts down because the program is available through a library interface, and so it can be called as a linked library in addition to being used as a standalone program. If it wasn't for that, we wouldn't even need free. The program is structured so that based on the parameters it is given, we know exactly what needs to be allocated: how many video frames need to be malloced and so…

Interesting. Thanks for the details. I'm guessing this is a non-interactive library\application which takes input at start-up, does work and then exits? (because otherwise, I assume it would be impossible to reason about how much memory is required)

The program is x264 and it can be interactive to some extent--it has a "reconfig" function that allows you to reconfigure the parameters on the fly, though it has some limitations as to what you can adjust and what you cannot.

One potential purpose of this is a "speed control" feature where you adjust settings on the fly to ensure realtime operation, such as for a broadcast encoding server (my company does this).

Re: Die, You Gravy Sucking Pig Dog

#26
post #4

> "In the C programming language, you're regularly forced to deal with the painful, dangerous concepts of pointers and explicit memory allocation. " > "I'd wager the majority of programmers alive today have never once worried about malloc(). I call this progress..." Anger. Must... resist... anger. I've come to believe that Jeff Atwood is on a personal mission sent by God himself to piss me off. Just remember, Jeff: e…

I know its somewhat trendy to pick on Jeff Atwood, but I don't really know what you're getting angry about. He never said that malloc and free are irrelevant. And manual memory management is dangerous and painful. Anyone who's written a modicum of C would agree with that. That a majority of programmers today don't have to worry about it is, in fact, progress.

I estimate that I've written about half a million lines of C code and I will have to strongly disagree with that.

Manual memory management just isn't that much of a big deal once you are experienced enough with C to organize your software into modules (usually individual C files with one corresponding header file). You just encapsulate the creation and destruction of elaborate data structures so that it's easy to verify that everything is cleaned up correctly.

These days I program mostly in Java and I spend a lot more time tracking down memory leaks than I ever did while I was programming in C.

Post reply on HN