First, here is the message valgrind gives me (this is just one error, I get the same message several times)
==25248== Invalid write of size 4
==25248== at 0x4024B3A: free (vg_replace_malloc.c:366)
==25248== by 0x8048F5E: sthread_free_ctx (sthread_ctx.c:86)
==25248== by 0x80489C1: sthread_user_exit (sthread_user.c:105)
==25248== by 0x804883C: dispatcher (sthread_user.c:40)
==25248== Address 0x41a6148 is 65,376 bytes inside a block of size 65,536 free'd
==25248== at 0x4024B3A: free (vg_replace_malloc.c:366)
==25248== by 0x8048F5E: sthread_free_ctx (sthread_ctx.c:86)
==25248== by 0x80489C1: sthread_user_exit (sthread_user.c:105)
==25248== by 0x804883C: dispatcher (sthread_user.c:40)
I dont understand it, because I am used to getting this error when I dont malloc enough space, so why am I getting the error when I am trying to free something?? what is being written?
thanks
It is difficult to tell with so little information (particularly: no code), but it looks to me like you may be attempting to call
freeon a pointer which refers to an offset into a memory region which has already been freed by an earlier call tofree.freeneeds to manipulate the heap data structures, so it is not surprising that it is attempting to write to the memory region.