# HG changeset patch # User John W. Eaton # Date 1322987925 18000 # Node ID c9a0e5343cd8894ef9eadc9e8fdf7ed11551186f # Parent b4d399c975de959bd00720a8a5f429c66b483262 use static storage for array nil rep instead of allocating it with new * Array.h (Array::ArrayRep::nil_rep): Use static object for nil rep instead of allocating it with new. diff --git a/liboctave/Array.h b/liboctave/Array.h --- a/liboctave/Array.h +++ b/liboctave/Array.h @@ -156,10 +156,12 @@ typename Array::ArrayRep *nil_rep (void) const { - static typename Array::ArrayRep *nr - = new typename Array::ArrayRep (); + // NR was originally allocated with new, but that does not seem + // to be necessary since it will never be deleted. So just use + // a static object instead. - return nr; + static typename Array::ArrayRep nr; + return &nr; } public: