octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Reducing memory by emulating IDL's temporary() function


From: Judd Storrs
Subject: Re: Reducing memory by emulating IDL's temporary() function
Date: Fri, 25 Apr 2008 12:54:26 -0400


On Fri, Apr 25, 2008 at 1:43 AM, Jaroslav Hajek <address@hidden> wrote:
1. there can be an explicit means of "give a value and deallocate".
Instead of creating a stand-alone `temporary', however, I suggest
extending `clear' to return the cleared value when called with nargout
= 1.

One challenge of changing clear like this is that the function form of clear requires a string argument. The demonstration code I posted also requires a string also but I considered that a bug in my implementation. Perhaps more importantly it could become more difficult run octave code on that other platform. Changing clear() will probably require octave code to be rewritten to run there. On the other a new function could be replaced by a no-op temporary.m

function A = temporary(A)
   return A;
end

2. It would be nice if Octave recognized the situation with expressions like
`A = func (A, B)'. This raises the question, however, what should
happen when exception
occurs inside `func'. Normally, if an exception occurs in evaluating
rhs, the lhs is not touched. Implementing a feature that would allow
treating calls `A = func(A)' as "call by reference" would unavoidably
violate this behaviour - the question is how much.

There could be some sort of evaluation flag/option mechanism for allowing or suppressing certain optimizations that might be considered "dangerous" within a region of code.

--judd


reply via email to

[Prev in Thread] Current Thread [Next in Thread]