That will give you a memory leak since you are creating an object but never
keep a pointer to it so that it can be freed.

Regards,
Elias
On Feb 22, 2015 5:26 PM, "Dirk Laurie" <dirk.lau...@gmail.com> wrote:

> Hi Jürgen:
>
> I've got code that works except for bugs unconnected with the GNU APL
> routines.
>
> I decided to implement the interface as a wrapper for an item of type
> `const Value_P&`. API.cc contains the following lines:
>
> // The commented-out variants give segmentation errors, I don't understand
> why.
> // Maybe needed only when `value` is Value*. not when it is already
> Value_P.
> // Jürgen will know.
> // #define PCLONE(valuep) valuep
> // #define PCLONE(valuep) Value_P(valuep)
> #define PCLONE(valuep) *(new Value_P(valuep))
>
> I.e. instead of initializing the item as e.g. `symbol->get_value()`,
> I initialize it as `PCLONE(symbol->get_value())`.
>
> I have not laboriously checked in which places this additional `new`
> is really necessary, all I know is that it is necessary for at least one
> of them.
>
> Best wishes
> Dirk
>
>

Reply via email to