# 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 -r b4d399c975de -r c9a0e5343cd8 liboctave/Array.h --- a/liboctave/Array.h Sun Dec 04 16:48:27 2011 +0000 +++ b/liboctave/Array.h Sun Dec 04 03:38:45 2011 -0500 @@ -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: