← Back to team overview

dolfin team mailing list archive

Re: [Question #116136]: Double Free on Writing to File

 

Question #116136 on DOLFIN changed:
https://answers.launchpad.net/dolfin/+question/116136

    Status: Open => Answered

Anders Logg proposed the following answer:
On Tue, Jun 29, 2010 at 04:34:04PM -0000, Pietro Maximoff wrote:
> Question #116136 on DOLFIN changed:
> https://answers.launchpad.net/dolfin/+question/116136
>
>     Status: Answered => Open
>
> Pietro Maximoff is still having a problem:
> I assumed/assume the call  to 'new' in
>          xy = new Array<double>(dim, geometry.x(vertex->index()));
> would be freed as the Array class has a destructor.

No it won't since there's no object that goes out of scope and calls
the destructor.

> But the main problem seems to be writing to the output to VTK file
>
>                  *** glibc detected *** ./colour_mesh: double free or
> corruption (out):
>
> Also, if I create a MATLAB output file, instead of a  VTK output file,
> it works fine, i.e.,
>
> File file("out.m");
> file << u.vector();
>
>
> What I've essentially tried to do in the code is:
>
> Load a 2D mesh (shape of a doughnut).
> For every vertex in the mesh,  if it's within a certain distance, the solution at that vertex is output as 20 otherwise as -86.
>
> I've used a vector to gather the individual entries and then converted
> it to a function for output. Please let me know If there's a more
> efficient way.

Unfortunately I don't have time to think about what the best solution
to your problem is right now, but if you send me a stripped down and
simple test program that segfaults because of a bug in DOLFIN, I will
fix the bug.

--
Anders

-- 
You received this question notification because you are a member of
DOLFIN Team, which is an answer contact for DOLFIN.