Commit 15282ca4 authored by GILLES Sebastien's avatar GILLES Sebastien
Browse files

Reformulation (mix of version before Vincent's change and his version).

parent 07e57f91
......@@ -195,7 +195,7 @@
"** Error in `./prog.exe': double free or corruption (fasttop): 0x0000000001532da0 **\n",
"```\n",
"\n",
"So what's the deal? The default operator copies all the data attributes from `v1` to `v2`... which here amounts only to the `array_` pointer. But it really copies that, the pointer, and not the data pointed by this pointer. So in fine v1 and v2 points to the same area of memory, and the issue is that we attempt to free the same memory twice.\n",
"So what's the deal? The default operator copies all the data attributes from `v1` to `v2`... which here amounts only to the `array_` pointer. But it really copies that: the pointer itself, _not_ the data pointed by this pointer. So in fine v1 and v2 points to the same area of memory, and the issue is that we attempt to free the same memory twice.\n",
"\n",
"One way to solve this is not to use a dynamic array - for instance you would be cool with a `std::vector`. But we can do so properly by hand as well (in practice don't - stick with `std::vector`!):\n"
]
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment