3 ms·
You can easily get unpredictable delays in responsiveness with reference counting too. How can you be sure releasing that reference isn't going to unleash the t
by cageface 16y ago
You can easily get unpredictable delays in responsiveness with reference counting too. How can you be sure releasing that reference isn't going to unleash the teardown of some huge data structure?
- jawngee 16y agoIf it does than you are doing something incredibly wrong. I'm really starting to doubt the intelligence of HN.
- cageface 16y agos/than/then/g
- jawngee 16y ago@cageface really? you can't refute my point, so you instead try to correct my spelling to make yourself look smarter?
- cageface 16y agoIf you choose to attack someone's intelligence instead of presenting a factual counterargument then it behooves you to get your spelling right. So again, how can you be sure that the reference you just released isn't the last live pointer to some huge datastructure that now has to be torn down reference-by-reference?
- jawngee 16y agoLike I said, if that happens you are doing something incredibly wrong. It is your error. It's not the language, it's bad programming, bad architecture, bad whatever. If you release an object and it gets torn down, it means you didn't increment the ref in the right place. And I don't get how release/retain is such a difficult concept to grasp. If you don't think you can deal with it, should this be your profession?
- cageface 16y agoBrushing aside the unnecessary and uncalled for rudeness... If you release the last pointer to a complex datastructure that has no other references, you certainly should hope it gets "torn down" = deallocated. If that object happened to contain a lot of other objects they will each in turn have to be released. Obviously your main code execution path is going to halt while this graph is walked and released. Maybe Jimbokun is right that you can control this better in a ref counting scheme than in a typical GC but you're hardly immune from the problem.
- deleted 16y ago[deleted]
- jimbokun 16y agoI think the idea is that, if you're careful, you can avoid situations like this with a reference counting scheme. With a garbage collector, there are more things that are out of the developer's control, like when exactly the garbage collector will run and for how long. C languages don't magically always perform better than other languages, but they do give you a greater level of control over what happens when. Whether that's a good or a bad thing is up to you.
- chc 16y agoThat's not unpredictable. You might not happen to foresee it, but it's pretty obvious when the teardown of a huge data structure might occur when you're the one releasing it.