On Tue, 14 Mar 2006, Edd Barrett wrote: > Hello people, > > I wish to query the usefullness (if thats not a made up word) of > electricfence on OpenBSD. I have a program which works great when not linked > against -lefence, but gives a bus error otherwise (not as a result of my > code, but in libpq according to a stack trace :O ). > > A google search later, and I find this page (http://kerneltrap.org/node/5584) > in which theo explains that the new malloc() does exactly what electric > fence does by default. So my question are: > > a) Why do we have a port of electric fence?
efence can also chekc smaller than page size allocations, iirc. It has been a long time since I ran it, since our standard malloc is now so much better, without the big overhead efence imposes. > > b) If my program runs fine on OpenBSD without -lefence can I assume that no > buffers have been over-run? No, not all buffer overruns are catched. For example, small allocations share a page, and so you can overwrite these without that being detected by malloc(). Also, in a lot of cases you actually get some more bytes than you ask for. Writing these extra bytes does not get caught. In general there is no way to test that your program is without overflows by just running it. > > c) (off-topic) How are people checking for memory leaks these days on > OpenBSD? I took a quick look at gc-boehm, but havent got it working as of > yet. How well does it work for you and what alternatives exist? It seems > most are using valgrind, but thats very linuxcentric if i understand > correctly. Good old code-inspection? -Otto