tim at home work and in between.
« May 2005 »
MonTueWedThuFriSatSun
      
1
2
3
4
6
7
8
9
10
11
12
13
14
15
16
17
18
19
21
22
23
24
27
28
29
30
31
     
Today
XML

Blog::Navigation

Site notes

This page validates as XHTML 1.0, and will look much better in a browser that supports web standards, but it is accessible to any browser or Internet device. It was created using techniques detailed at glish.com/css/.

Technorati

Tim Uglow's personal blog

timu_at_home
Powered by Roller Weblogger.
« Previous day (May 24, 2005) | Main | Next day (May 25, 2005) »
20050525 Wednesday May 25, 2005
wierd malloc problem.

A collegue asked me to help debug a userland core file a couple of days ago. The stack showed the normal segv in a frame under realfree() that is so typical of a malloc arena corruption. The standard malloc keeps some housekeeping in the 8 bytes below the pointer that malloc returns, once you call free() those 8 bytes and the first few of the allocation are cast into an internal data structure and it is added to a b-tree sorted by size. It is not until another malloc/free causes a change in the tree that corruption is detected. As this can happen a long time after the free the program can segv long after the damage - another reason to use libumem or libwatchmalloc or ...

I thought it would be easy as there was a testcase, just load up libumem or my own debugging malloc library, run the testcase and point out the incorrect code. But it wouldn't fail with those. I interposed on malloc/free/calloc/valloc/memalign but I could see no obvious error like a double free. My current theory is that something is trampling over the structure after it has gone on the free list, time to become more of a dbx power user, or maybe write a mdb dcmd to verify the malloc arena at regular intervals.

Once that is done I can get back to putting the sparc emulator into my crash dump running program.

too lazy

I've been really lazy, lots of miles in the SMART and only a few on the bike. My May resolution is to stop driving to work. I have a medical due soon so time to drink low alchohol beers to get rid of that extra 7 pounds that have crept on, and do more exercise to get my resting heart rate back into the forties

Copyright (C) 2003, tim at home work and in between.