User forums > Help
"optimize even more (for speed)" flag crashes application
Krice:
--- Quote from: ValeV on April 02, 2019, 12:59:24 pm ---But the program crashed even if I just opened and quickly closed it. I didn't do any other operations. How can buffer overrun happen?
--- End quote ---
Why can't it happen if it's in the code that runs when you run the program. Buffer overruns are not the only thing that can mess up memory management. Memory allocations do that, too.
Miguel Gimenez:
And use-after-free, very frequent when closing applications.
ValeV:
--- Quote from: Miguel Gimenez on April 03, 2019, 09:24:26 am ---And use-after-free, very frequent when closing applications.
--- End quote ---
--- Quote from: Krice on April 03, 2019, 09:11:28 am ---
--- Quote from: ValeV on April 02, 2019, 12:59:24 pm ---But the program crashed even if I just opened and quickly closed it. I didn't do any other operations. How can buffer overrun happen?
--- End quote ---
Why can't it happen if it's in the code that runs when you run the program. Buffer overruns are not the only thing that can mess up memory management. Memory allocations do that, too.
--- End quote ---
Thank you for suggestions. Though I still don't understand how "optimize even more" flag in CodeBlocks would hide/fix the problem?
Krice:
--- Quote from: ValeV on April 04, 2019, 07:57:26 am ---Though I still don't understand how "optimize even more" flag in CodeBlocks would hide/fix the problem?
--- End quote ---
Optimization changes the memory layout of the program which can make some bugs crash the program. Or it crashes in different place. When you debug memory management crashes they often don't stop at the exact point of error, but later. Sometimes libraries can be blamed, because they force you to conform some ugly rules. I think wxwidgets is one of those, because as far as I know it has some kind of special memory management going on with smart pointers. In my opinion smart pointers should never have been added in C++, because it's just not the way C++ works. There is nothing wrong with manual memory management if it doesn't have bugs, obviously.
sodev:
--- Quote from: Krice on April 04, 2019, 09:05:09 am ---There is nothing wrong with manual memory management if it doesn't have bugs, obviously.
--- End quote ---
Human is a bug that cant be fixed ;D
Navigation
[0] Message Index
[*] Previous page
Go to full version