Re: incorrect checksum for freed object
On 8/18/2010 8:37 AM, Philipp Kraus wrote:
I'm to create a multithreaded algorithm and I get this runtime error
message:
incorrect checksum for freed object - object was probably modified after
being freed
[...]
With one thread everything works fine, on more threads I'll get the
error message. I understand this correctly, that the message says that
several threads on another object to access and modify data there?
The statement after the last 'that' is supposed to be complete. Let's
try to use it as a separate sentence:
"Several threads on another object to access and modify data there"
"Several threads" is the subject.
"Another object" is the object (with "on" as the preposition).
Where is the verb? Several threads WHAT on another object?
I would like to understand the message in that way, that I can solve my
problem
If you pass some object by reference to any threads, make sure that the
object *survives* while there is at least one thread using it. The best
approach is the reference counting. Increment the counter just before a
thread begins using the object. When the thread is done using that
object, *the thread* must decrement the reference counter. When the
counter goes to zero, the object should delete itself.
V
--
I do not respond to top-posted replies, please don't ask