Closed kostrzewa closed 7 years ago
The additional element is some fudging such that accesses to that area are not access violations. I think it would be safer to let that in there. Then a check in the free
function would be a good idea to make it more safe.
In the longer run, these functions should be hidden from the user and only the RAII containers shall be used. Then the user does not have to call free
and that problem is solved as well. Except when you want to have a couple of pointers and not allocate memory for all of them. But I would think that one could solve this neatly with RAII as well.
I have added such a check.
@bjoo @martin-ueding
I remember that this was discussed some time ago, an additional spinor block is allocated for the spinor fields and the allocator returns a pointer to the second element. Consequently, the corresponding free is passed
p-1
rather thanp
. Now this works fine, of course, but it breaks the convention that a nullptr is okay to be free'd. Do we want to remove the additional element or should I check for null in the free?