Re: Compile + Module => Memory Leak
- To: mathgroup at smc.vnet.net
- Subject: [mg39939] Re: Compile + Module => Memory Leak
- From: Bill Rowe <listuser at earthlink.net>
- Date: Wed, 12 Mar 2003 02:31:33 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
On 3/11/03 at 2:37 AM, bgress at mail.DOTucr.DOT.edu (Bern) wrote: [example snipped] >Presumably, upon exit, a Module should release any memory used, no? No, I don't believe this is the way Mathematica deals with memory. My understanding is Mathematica releases memory that is no longer needed as determined by whether there are expressions that reference that memory. Once all of the expressions that reference a piece of memory are deleted the referenced memory is released. In the code you posted (that I snipped) the Module construct creates symbolic references. The code does not delete the created symbols. As far as I know, neither Module nor Block deletes symbols created unless you write code to specifically do this. Since the symbols are not specifically deleted, the memory these symbols reference is not released.