Someone recently asked a very interesting question over at programmers.stackexchange.com. Unfortunately, though somewhat predictably, people jumped all over it and it ended up getting closed and then deleted within 20 minutes of being asked. That’s actually happening a lot recently, to the detriment of the community IMO, but that’s a subject for another time. But I think there’s some actual, worthwhile discussion to be had in this deleted question, so I’m preserving it here, along with the answer I would have posted. Hopefully it’ll be of interest to some people. Continue reading ‘Programmers and social skills’ »
Posts tagged ‘StackOverflow’
For those who haven’t seen it yet, due to popular demand, the StackOverflow people created a new site called programmers.stackexchange.com, a site for the more subjective questions that StackOverflow isn’t really designed for. Someone recently set up a poll: What’s your favorite programming language. You can probably guess what my answer was. Continue reading ‘Little things Delphi gets right’ »
I ran into an old friend of mine on Messenger today, who I haven’t seen in several years. We were great friends in high school and ended up going to the same college, but then sorta drifted apart. So we spent a while catching up and talking about how things were going in each other’s lives.
He’d always been a pretty serious computer geek, so I asked him if he knew about StackOverflow. The part I didn’t remember, at least right away, was that he was not only into programming, but also computer security and “ethical hacking” type of stuff. So his response kinda caught me off guard.
“Yeah, of course. It’s a great way to gain root!”
*facepalm* Not quite what I meant…
Most of my posts on here have been about technical subjects, geared towards moderate-to-advanced Delphi coders. This one’s to help out the beginners who are still learning the ropes. I’d like it to be something that people can send new users to from StackOverflow or other sites if they’re having trouble figuring out how to clean up their memory properly.
I’ve never really understood why people find memory management difficult. Maybe I just “get it” for some reason, but it’s never seemed all that arcane or complex to me. In all my time working with Delphi, I’ve only run into one truly difficult memory management scenario, and it’s something that most people won’t ever have to deal with: sharing global interface references across package boundaries. If you do that wrong, you’re likely to run into some very strange errors at program shutdown that are hard to debug.
But people keep asking questions about the basics of what to free and how to free it on StackOverflow, and from answering them and analyzing the questions and the answers, it seems to me that the entirety of memory management can be boiled down to one single principle.
This morning on StackOverflow, someone asked a question about invoking constructors through extended RTTI. It happened that I’d had to work out a way to do that a couple weeks ago, and it took me about 5 minutes to find the code, strip out a few specific details and type up a solution. I got an accepted response, a few upvotes, and a very interesting comment from the author: