[comp.unix.programmer] Data Corruption

pthonda@bgsuvax.UUCP (Killer B) (03/20/91)

Hi, I am getting data corruption.I have a pointer to an integer and I 
check the value it's pointing to in a loop.For some iterations the value
is okay, but unexpectedly there is a change in the value .Can somebody
help me .

Thanx in advance

Pratap
.

jik@athena.mit.edu (Jonathan I. Kamens) (03/20/91)

In article <7187@bgsuvax.UUCP>, pthonda@bgsuvax.UUCP (Killer B) writes:
|> Hi, I am getting data corruption.I have a pointer to an integer and I 
|> check the value it's pointing to in a loop.For some iterations the value
|> is okay, but unexpectedly there is a change in the value .Can somebody
|> help me .

  Given only the information in your posting, it is virtually impossible for
us to help you.

  The most likely explanation for your problem is, "There is a bug in your
program."  That is, at some point in your program, you do some incorrect
pointer math, or write past the end of a previously allocated block of data,
or something like that.

  You haven't told us what your program does.  You haven't told us what kind
of machine you're using, or what version of Unix it's running.  You haven't
told us what happens in your program in between the last check that indicates
the correct value and the first check that indicates the incorrect value.  You
haven't given us your source code so that we can help you figure out what's
wrong.  You can't given us a small test program that exhibits this problem.

  Is the pointer exhibiting this problem a pointer into a region of memory
allocated with malloc() or calloc()?  If so, have you considered using one of
the various malloc debugging packages available on the net for pinpointing
more accurately where in your program the malloc arena gets corrupted?

-- 
Jonathan Kamens			              USnail:
MIT Project Athena				11 Ashford Terrace
jik@Athena.MIT.EDU				Allston, MA  02134
Office: 617-253-8085			      Home: 617-782-0710