Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #4160

Re: Memory leak or flawed garbage collector

From Daniel Lichtblau <danl@wolfram.com>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: Memory leak or flawed garbage collector
Date 2011-08-03 11:16 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <j1balr$ao9$1@smc.vnet.net> (permalink)
References <j0u7mo$fc1$1@smc.vnet.net> <j10l01$os6$1@smc.vnet.net> <j15738$b4a$1@smc.vnet.net> <201108021111.HAA29331@smc.vnet.net>

Show all headers | View raw


On 08/02/2011 06:11 AM, Alexey Popkov wrote:
> "Oleksandr Rasputinov"<oleksandr_rasputinov@hmamail.com>  wrote:
> news:j15738$b4a$1@smc.vnet.net...
>>    From this we may surmise that values are not being cleared for symbols
>> appearing in a Module that have gone out of scope if the delayed flag is
>> set and if they have also been conditionally evaluated. It appears that
>> these values are what is preventing garbage collection; therefore I would
>> consider this as a bug in Module (in that it does not recognise when
>> values have gone out of scope in all cases) rather than in the garbage
>> collector itself.
>
> Consider the following simple experiment without Module:
>
> In[1]:= $HistoryLength=0;
> a[b_]:=(SetAttributes[d,Temporary];d:=9;d/;b===1);
>
> In[3]:= a[1]
> Out[3]= 9
>
> In[4]:= Definition[d]
> Out[4]= Attributes[d]={Temporary}
>
> d:=9
>
> As you see, the same bug appears without Module. So I think this is a bug in
> the garbage collector itself. As for Module, I feel that this function is
> essentially top-level, as opposed to Block. Probably it is possible to write
> full analog of Module in top-level Mathematica code.
> [...]

It does not require a condition test to elicit this behavior.

In[3]:= $HistoryLength = 0;
a[] := (SetAttributes[d, Temporary]; d := 9; d);

In[5]:= a[]

Out[5]= 9

In[6]:= ?? d

Global`d

Attributes[d]={Temporary}

d:=9

This is probably not incorrect behavior. Setting a Temporary attribute 
is not documented to have any effect, so far as I can tell. Module will 
set the attribute on its parameters, but that's a different matter.


Daniel Lichtblau
Wolfram Research

Back to comp.soft-sys.math.mathematica | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Memory leak or flawed garbage collector "Fabrice P. Laussy" <fabrice.laussy@gmail.com> - 2011-07-29 12:05 +0000
  Re: Memory leak or flawed garbage collector "Oleksandr Rasputinov" <oleksandr_rasputinov@hmamail.com> - 2011-07-30 10:04 +0000
    Re: Memory leak or flawed garbage collector "Alexey Popkov" <lehin.p@gmail.com> - 2011-07-31 11:27 +0000
    Re: Memory leak or flawed garbage collector "Oleksandr Rasputinov" <oleksandr_rasputinov@hmamail.com> - 2011-08-01 03:38 +0000
      Re: Memory leak or flawed garbage collector "Alexey Popkov" <lehin.p@gmail.com> - 2011-08-02 11:12 +0000
      Re: Memory leak or flawed garbage collector Daniel Lichtblau <danl@wolfram.com> - 2011-08-03 11:16 +0000
    Re: Memory leak or flawed garbage collector "Oleksandr Rasputinov" <oleksandr_rasputinov@hmamail.com> - 2011-08-03 11:15 +0000
    Re: Memory leak or flawed garbage collector "Alexey Popkov" <lehin.p@gmail.com> - 2011-08-11 09:19 +0000
    Re: Memory leak or flawed garbage collector "Oleksandr Rasputinov" <oleksandr_rasputinov@hmamail.com> - 2011-08-12 09:11 +0000

csiph-web