Timeline for Does allocating and freeing a huge chunk of memory at startup "clean up memory?"
Current License: CC BY-SA 3.0
16 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jun 9, 2017 at 0:48 | history | edited | user1430 | CC BY-SA 3.0 |
edited body; edited tags; edited title
|
Jul 2, 2014 at 23:03 | vote | accept | glampert | ||
Jul 2, 2014 at 20:54 | comment | added | Damon |
@glampert: Even assuming that's the case, operator delete is required to accept nullptr and treat it as no-op. Any global overload that doesn't do that is broken. Which means it's nonsensical either way. Just like assuming that allocating a huge block of memory and releasing it will "magically" do something good. At best, it won't do any harm (most likely, since the pages aren't even touched... otherwise it may swap out some pages from your working set which you'll need to reload later).
|
|
Jul 2, 2014 at 20:20 | comment | added | bandybabboon | You have to figure out what possible "ineffecient clogging of memory" can occur relative to your task. best way is just to test it in real apps. other than chrome using 400 k of memory while you play a game, and other apps, there isnt much to clear up. | |
Jul 2, 2014 at 19:51 | history | edited | glampert | CC BY-SA 3.0 |
Made some small adjustments in the text.
|
Jul 2, 2014 at 19:26 | comment | added | glampert |
@Damon, I didn't check, but I suspect they've at least overloaded the global new operator to return null instead of throwing bad_alloc . If they didn't, then yes, this code is even more nonsensical :P
|
|
Jul 2, 2014 at 15:02 | comment | added | Damon |
Game Coding Complete contains a lot of nonsense paired with a lot of not-understanding-C++ and C-that-looks-a-bit-like-C++ (also demonstrated in this sample, checking the result of operator new for nullptr ), if you allow me to say. Best thing you can do with that book is light your chimney. Allocating and freeing a large block of memory of course doesn't "clean up" memory.
|
|
Jul 2, 2014 at 14:59 | history | edited | user1430 | CC BY-SA 3.0 |
edited title
|
Jul 2, 2014 at 13:35 | comment | added | Dan Is Fiddling By Firelight | Does clearing a long strip of ground in the jungle, carving a radio, headphones, etc out of wood result in airplanes landing and delivering supplies? | |
Jul 2, 2014 at 12:54 | comment | added | Vality | Most modern OSes will do nothing whatsoever when an app allocates a large area of memory, they use optimistic allocation and do not actually do anything until you fill the memory, I cannot imagine this doing anything more than being a potentially slow no-op | |
Jul 2, 2014 at 12:44 | answer | added | Ilmari Karonen | timeline score: 12 | |
Jul 2, 2014 at 8:07 | history | edited | Anko | CC BY-SA 3.0 |
Reduced emphasis levels at start. Condensed and clarified.
|
Jul 2, 2014 at 5:09 | history | tweeted | twitter.com/#!/StackGameDev/status/484202084741705729 | ||
Jul 2, 2014 at 4:29 | answer | added | Panda Pajama | timeline score: 26 | |
Jul 2, 2014 at 3:14 | history | edited | glampert | CC BY-SA 3.0 |
added 86 characters in body
|
Jul 2, 2014 at 3:09 | history | asked | glampert | CC BY-SA 3.0 |