[Dune] [#768] testgenericfem failes

Dune flyspray at dune-project.org
Fri Apr 9 18:26:45 CEST 2010


The following task has a new comment added:

FS#768 - testgenericfem failes
User who did this - Jö Fahlke (joe)

Actually the test failed with multi-precision types (gmp or alglib or
similar).  The patch you mentioned replaces the use of stc::memcpy in the copy
constructor and the assignment operator of the FieldVector with a for loop.

If you think about it, it is not surprising that memcpy() causes problems with
multi-precision types: these types can often be arbitrary precision, so they
cannot store all data in the object itself.  Instead, the must allocate some
memory and store a pointer to that memory in the object.  memcpy() does a
shallow copy; it will copy the pointer, but it won't duplicate the pointed to
data.  Now you have to pointers pointing to the same region of memory with two
objects feeling resonsible to free that memory when they are done, leading to
a use-after-free or a double-free error.  In addition, the object that was
assigned to may have already allocated some memory but the pointer was
overwritten so that memory cannot be freed anymore, leading to a memory leak.


More information can be found at the following URL:

You are receiving this message because you have requested it from the Flyspray bugtracking system.  If you did not expect this message or don't want to receive mails in future, you can change your notification settings at the URL shown above.

More information about the Dune mailing list