Re: check this please???
- Posted by Robert Craig <rds at ATTCANADA.NET> Aug 18, 2000
- 470 views
Paul writes: > Okay, I am having a tough time with this segmentation error problem. > To test something I wrote a very simple allocate and free program, I > am using safe.e in place of machine.e to test it with. This little > program written on a linux (SuSe) platform caused a > segmentation fault. Anyone have a clue?? > include safe.e -- I assume you included this -- Rob > with trace > trace(1) > procedure main() > atom data > data = allocate(8) > free(data) > end procedure It crashed on my Red Hat system too. You've found a bug in safe.e. All users of safe.e should change the line in global procedure free() in safe.e (*not* machine.e!) that reads: machine_proc(M_FREE, a) to instead read: machine_proc(M_FREE, a - BORDER_SPACE) The bug doesn't show up under WATCOM because WATCOM's storage allocator does very little on a free() operation, just setting a bit. GNU C probably tries to combine adjacent free blocks. WATCOM does the combining during the malloc(). I think it will simply fail to actually free the block. Paul: after fixing safe.e, continue running your large application. If you are lucky, safe.e will now find your bug. And thanks for reporting this safe.e bug. Regards, Rob Craig Rapid Deployment Software http://www.RapidEuphoria.com