Re: Abnormal Behaviour.



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
.



Relevant Pages

  • Re: El sections of LU
    ... Hammersmith & City west of Paddington and east of Bow Road ... That is well done from memory - but I think he means 'above street ... the Picc is on a viaduct at ... a shallow cutting by Rayner's Lane (actually, it's more of a case of the ...
    (uk.transport.london)
  • Re: Abnormal Behaviour.
    ... point when i Malloc and NOTHING ELSE HAPPENS... ... sigsegv, no NULL returned by malloc, everything's fine, but the app ... Anyway when i do the city continues working for some time and then i ... of allocated memory. ...
    (comp.unix.programmer)
  • Re: El sections of LU
    ... Hammersmith & City west of Paddington and east of Bow Road ... Jubilee north of Finchley Road and east of Canning Town ... That is well done from memory - but I think he means 'above street ...
    (uk.transport.london)
  • Re: Abnormal Behaviour.
    ... point when i Malloc and NOTHING ELSE HAPPENS... ... Anyway when i do the city continues working for some time and then i ... of allocated memory. ... Memory leaks do *NOT*, in and of themselves, cause segfaults. ...
    (comp.unix.programmer)
  • Thank You -- Thomas J. Gritzan
    ... Thomas -- Your suggestion to malloc() out a block of memory was the ... Below are some details of my memory issues ... ... As a work around solution I guessed a ram disk would solve the ... persistence will frustrate the off topic police and give them a target ...
    (comp.lang.c)

Loading