By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,171 Members | 1,020 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,171 IT Pros & Developers. It's quick & easy.

free(): invalid pointer

P: n/a
Hi All,

I have written a C++ program, it can be compiled (in UNIX) but when I
run it, I usually gives the following errors:

free(): invalid pointer 0x51d4a0!
free(): invalid pointer 0x51d460!
free(): invalid pointer 0x51d760!
free(): invalid pointer 0x51d7e0!
..
..
..

Can anyone help me to know what is the reason for this problem?

Thanks,

Jun 14 '06 #1
Share this Question
Share on Google+
4 Replies


P: n/a
c language wrote:
Hi All,

I have written a C++ program,
Then you should go down the hall to the C++ group.
it can be compiled (in UNIX) but when I
run it, I usually gives the following errors:

free(): invalid pointer 0x51d4a0!
free(): invalid pointer 0x51d460!
free(): invalid pointer 0x51d760!
free(): invalid pointer 0x51d7e0!
..
..
..

Can anyone help me to know what is the reason for this problem?

Passing an invalid pointer to free? When you post on the C++ group,
include the code.

--
Ian Collins.
Jun 14 '06 #2

P: n/a
c language wrote:
Hi All,

I have written a C++ program, it can be compiled (in UNIX) but when I
run it, I usually gives the following errors:

free(): invalid pointer 0x51d4a0!
free(): invalid pointer 0x51d460!
free(): invalid pointer 0x51d760!
free(): invalid pointer 0x51d7e0!

Can anyone help me to know what is the reason for this problem?


Why don't you try posting your question, along with a small, complete,
compilable example that demonstrates your issue, to comp.lang.c++. It
is very difficult to know exactly what the problem is without seeing
your code although, and I am going out on a limb here, you may be
trying to free an invalid pointer (i.e. a pointer that was not returned
to you by malloc and friends).

Robert Gamble

Jun 14 '06 #3

P: n/a

make sure the memory your pointer point to is allocated by fuction
"malloc"!

Jun 14 '06 #4

P: n/a
seni.yin schrieb:
make sure the memory your pointer point to is allocated by fuction
"malloc"!


What are you responding to? Please quote sufficient context.
The above may be right or wrong, depending on the context.

Cheers
Michael
--
E-Mail: Mine is an /at/ gmx /dot/ de address.
Jun 14 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.