Timeline for C++ delete vs Java GC
Current License: CC BY-SA 3.0
31 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Dec 13, 2018 at 2:14 | answer | added | user321630 | timeline score: 1 | |
| Jun 29, 2016 at 13:44 | history | tweeted | twitter.com/StackProgrammer/status/748150251157086208 | ||
| Jun 21, 2016 at 7:43 | comment | added | Jules | And a solution to the busy beaver problem can be turned into a solution to the halting problem by running machines until they either (1) halt, (2) repeat a state with identical tape content or (3) use more tape than the busy beaver output for turing machines with the same number of states. In either of cases 2 or 3 we can conclude that the machine does not halt. If (1) or (2) does not happen, we can conclude that (3) must eventually happen as all other possible tape configurations are used up. | |
| Jun 21, 2016 at 7:36 | comment | added | Jules | @sixtytrees - "This isn't really a halting problem. This is rather a "busy beaver" problem." - the two are equivalent. A solution to the halting problem can be turned into a solution to the busy beaver problem by enumerating all n-state turing machines, filtering those that do not halt, then running the ones that do halt to find the one with the largest output. | |
| Jun 20, 2016 at 20:10 | comment | added | Doval |
@RobK By bookkeeping I wasn't referring to code, I was talking about the memory allocator, i.e. the work new and delete have to do behind the scenes to keep allocation and deallocation efficient.
|
|
| Jun 20, 2016 at 20:07 | comment | added | Rob K |
@Doval, if you're using RAII correctly, which is pretty simple, there's almost no bookkeeping at all. new goes in the constructor of your class which manages the memory, delete goes in the destructor. From there, it's all automatic (storage). N.B. that this works for all types of resources, not just memory, unlike garbage collection. Mutexes are taken in a constructor, released in a destructor. Files are opened in a constructor, closed in a destructor.
|
|
| Jun 20, 2016 at 19:24 | comment | added | Servy | @Thomas And in contexts like that it's often worth the effort to use a language that explicitly manages memory, so that you can better address that. For the large percentage of applications that don't have such concerns, they can feel comfortable using a managed memory language. | |
| Jun 20, 2016 at 16:40 | answer | added | JimmyJames | timeline score: 3 | |
| Jun 20, 2016 at 16:30 | comment | added | Thomas | @ThomasCarlisle: On mobile platforms, especially in games, GC matters a lot. | |
| Jun 20, 2016 at 16:00 | answer | added | Jerry Coffin | timeline score: 2 | |
| Jun 17, 2016 at 19:57 | comment | added | Thomas Carlisle | I'm not saying that garbage collection doesn't have an impact. I am just pointing out that I have not had to spend time troubleshooting or working around GC "freezes", and have never had it happen that garbage collection was a significant bottleneck to meeting processing time objectives. There is a lot more going on in memory management than just making sure every object is disposed to prevent leaks. Whether you code in c++ and mange memory yourself or use a GC language and distance yourself from those details to focus more on the business logic, it takes compute cycles to manage memory. | |
| Jun 17, 2016 at 15:41 | comment | added | Doval |
It's worth pointing out that allocating memory dynamically with new and delete involves similar levels of bookkeeping and complex algorithms as a garbage collector. You can't just naively hand out chunks of memory or it'll end up full of holes.
|
|
| Jun 17, 2016 at 15:11 | vote | accept | sixtytrees | ||
| Jun 17, 2016 at 14:00 | answer | added | Nikko | timeline score: 5 | |
| Jun 17, 2016 at 13:35 | comment | added | JensG | "Placing all relevant delete keywords is a mechanical task" -- That's why there are tools to detect memory leaks. Because it is so simple and not error-prone at all. | |
| Jun 17, 2016 at 13:20 | history | edited | Nicol Bolas | CC BY-SA 3.0 |
"C/C++" is not a langauge. And memory management is *very different* between the two.
|
| Jun 17, 2016 at 11:30 | comment | added | Deduplicator | @ThomasCarlisle There's a world of difference between having an impact and that impact being noticed. The latter is especially unlikely if your resources far exceed the requirements, or you don't actually have something to compare against. | |
| S Jun 17, 2016 at 2:28 | history | suggested | Christophe |
added the c++ tag because question refers to it and especially to `delete` which doesn't exist in C
|
|
| Jun 17, 2016 at 0:27 | answer | added | kamilk | timeline score: 4 | |
| Jun 17, 2016 at 0:24 | comment | added | Hulk | @ThomasCarlisle well it can - and occasionally does - impact performance. But there are lots of parameters to tweak in these cases, and sometimes the solution may be to switch to a different gc altogether. It all depends on the amount of available resources and the typical load. | |
| Jun 16, 2016 at 23:47 | review | Suggested edits | |||
| S Jun 17, 2016 at 2:28 | |||||
| Jun 16, 2016 at 23:46 | answer | added | Christophe | timeline score: 18 | |
| Jun 16, 2016 at 23:06 | comment | added | Thomas Carlisle | I have never had garbage collection make a material impact on performance of my code in either java or c#. Am I in the minority? | |
| Jun 16, 2016 at 19:22 | answer | added | gnasher729 | timeline score: 5 | |
| Jun 16, 2016 at 19:19 | history | edited | sixtytrees | CC BY-SA 3.0 |
added 394 characters in body; edited title
|
| Jun 16, 2016 at 19:11 | comment | added | sixtytrees | This isn't really a halting problem. This is rather a "busy beaver" problem. | |
| Jun 16, 2016 at 19:09 | comment | added | Richard Tingle | Also modern java doesn't freeze except under extreme condition where vast quantities of garbage are created | |
| Jun 16, 2016 at 19:07 | comment | added | Richard Tingle | I find it difficult to believe that your magic script could exist. Apart from anything wouldn't it have to contain a solution to the halting problem. Or alternatively (and more likely) only work for incredibly simple programs | |
| Jun 16, 2016 at 19:05 | answer | added | Ju Shua | timeline score: 3 | |
| Jun 16, 2016 at 18:59 | review | First posts | |||
| Jul 16, 2016 at 18:59 | |||||
| Jun 16, 2016 at 18:54 | history | asked | sixtytrees | CC BY-SA 3.0 |