- Abort during delete - 3 Updates
James Kuyper <jameskuyper@verizon.net>: Jan 21 04:00PM -0500 On 01/21/2018 03:36 PM, James Kuyper wrote: ... > more C-bound than you or me. The part of the code i'm looking at has no > containers, no iterators, no algorithms. Just lots of C-style arrays, > pointers, and arrays. That was supposed to read "and for loops". |
Christian Gollwitzer <auriocus@gmx.de>: Jan 21 11:45PM +0100 Am 21.01.18 um 21:27 schrieb James Kuyper: > produces too much information to make it easy to find the particular > issue that's actually causing a problem, particularly on poorly written > code like this. I can only second this suggestion. Valgrind has a very low false positive rate. If it signals an error, usually you should fix it. "Invalid read" means read from an uninitialized memory, which can be harmless, but "invalid write" always means there is an error. It is totally worth to fix all of them, even if it appears that there are no problems. Another tool, in case you build with clang, is -fsanitize=address Christian |
Jerry Stuckle <jstucklex@attglobal.net>: Jan 21 06:03PM -0500 On 1/21/2018 1:39 PM, James Kuyper wrote: > involving that other allocation. > Is this in fact the case? Are there any other things that might cause a > delete-expression to fail? Memory can be reused. For instance, it is also possible that some other code allocated memory and got a block at "X" back. Later, when it deletes the memory, "X" is now available for reuse. Now your code allocates a new object and gets it at "X". No problem - except maybe the pointers to that old object are still around someone else tries to use or even delete that old object. Problems like this are hard to find and almost always require a debugger. OTOH, they occur more often than many programmers realize. -- ================== Remove the "x" from my email address Jerry Stuckle jstucklex@attglobal.net ================== |
You received this digest because you're subscribed to updates for this group. You can change your settings on the group membership page. To unsubscribe from this group and stop receiving emails from it send an email to comp.lang.c+++unsubscribe@googlegroups.com. |
No comments:
Post a Comment