Re: Abnormal Behaviour.
- From: gordonb.7guc9@xxxxxxxxxxx (Gordon Burditt)
- Date: Sun, 25 Jun 2006 03:47:09 -0000
ok. Now. everything runs smoothly UNTIL i add a Team to , say, City B.
I should say that the City is "Prepared" to handle "n" Teams.
Anyway when i do the city continues working for some time and then i
get a Horrible SIGSEGV in City B
I gave you this example because i could run 3 teams in CityA and 2 in
city B and there's no trouble but when i add another (a third) to City
B => BUM!
I found out that this happens when i add a third but The instruction
where the city Fails is almost ALWAYS different, but is always when i
do a Malloc. ALWAYS with Malloc.
If you are segfaulting in malloc() it is likely that something is
stomping malloc's list of memory, usually by writing off the end
of allocated memory. Or sometimes it is caused by calling free()
on the same memory twice - the next malloc() call searching that
part of the free list will fail.
So, since it happens with malloc i guess that there must be some memory
leaks,
Memory leaks do *NOT*, in and of themselves, cause segfaults.
Many programs would run fine if they never free() memory at all
and just leaked everything (unless the program actually runs out
of memory. This is not recommended practice but blaming segfaults
on memory leaks is not helpful.
Memory leaks combined with failure to check the return value of
malloc() for being NULL, in combination with actually running out
of memory, might cause segfaults. I think the memory-stomping
theory is MUCH more likely to be the problem.
is there some important caution i should take regarding forking
Execving processes?
Don't fork() if you have written off the end of allocated memory.
For that matter, you shouldn't do much but call abort() in that
situation.
I should add that:
i run city A on a Debian and City B on a SuSe and SuSe seems to be
having trouble whth thise while Debian isnt. weird ah?
I've seen plenty of situations where the program only fails if you
remove all of the debugging printf() calls. Fixating on this is
usually NOT helpful to finding the problem.
Ok. So any suggestions are MORE than welcome i have Less than a week to
solve this.
Gordon L. Burditt
.
- Follow-Ups:
- Re: Abnormal Behaviour.
- From: ifmusic
- Re: Abnormal Behaviour.
- References:
- Abnormal Behaviour.
- From: ifmusic
- Abnormal Behaviour.
- Prev by Date: Abnormal Behaviour.
- Next by Date: Re: coderwiki.com is starting and needs you!
- Previous by thread: Abnormal Behaviour.
- Next by thread: Re: Abnormal Behaviour.
- Index(es):
Relevant Pages
|
Loading