Date: prev next · Thread: first prev next last
2011 Archives by date, by thread · List index



On Fri, 2011-11-18 at 12:51 +0100, Bjoern Michaelsen wrote:
I would rather argue that adding redundant "p = 0;" following a
"delete p;" makes our code worse, not better (even if that may sound
paradoxical at first):
[...]

I generally agree.

        Ditto, the code should (ideally) be clean, sweet, easy to read, free
from redundancy (of which this is a kind), have unit tests etc. :-) at
least, I hope that's the goal.

 but for debugging (non-product builds only) it might make
sense to mark a pointer as dead, to easier identify if the zombie pointer is
still dereferenced.

        IMHO it would make some sense to zero memory at both allocate and free
time in product builds; it is a linear incremental cost of course - but
(perhaps) frees us from some of these uninitialized corner-case bugs
that we see around the place [ though I forget if we're using the sal/
allocator for general 'new' calls - presuambly so ].

        Of course, it'd be the first thing to show up on a profile, but ...
that's only meaningful for the micro-optimisers who don't see the big
picture ;->

        IIRC the export MALLOC_CHECK_=2 we see in ooenv already sets memory
dirting on free for our development builds anyway, and we seem to do
quite well there.

        HTH,

                Michael.

-- 
michael.meeks@suse.com  <><, Pseudo Engineer, itinerant idiot


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.