The Mathematica Journal
Departments
Download This Issue
Home
Feature Articles
Graphics Gallery
Tricks of the Trade
In and Out
Columns
The Mathematica Programmer
New Products
New Publications
Classifieds
Calendar
News Bulletins
Editor's Pick
Mailbox
Letters
Write Us
About the Journal
Staff and Contributors
Submissions
Subscriptions
Advertising
Back Issues

Memory Management

Q: Consider the following session. Check to see how much memory is in use.
[Graphics:../Images/index_gr_2.gif]
[Graphics:../Images/index_gr_3.gif]
Load in a data file.
[Graphics:../Images/index_gr_4.gif]
Check to see how much memory is presently in use.
[Graphics:../Images/index_gr_5.gif]
[Graphics:../Images/index_gr_6.gif]
Clear the expression which was assigned when the data was loaded.
[Graphics:../Images/index_gr_7.gif]
Again check to see how much memory is presently in use.
[Graphics:../Images/index_gr_8.gif]
[Graphics:../Images/index_gr_9.gif]
Since I have cleared the expression, why has the memory use not gone down?
A: David Withoff (withoff@wolfram.com) answers: If the memory associated with the value of data is not recovered, this means that the value may still be in use. Here the value of data is being used in a value of Out. You can recover that memory by clearing Out or by unsetting the appropriate value of Out, as in:
[Graphics:../Images/index_gr_10.gif]
[Graphics:../Images/index_gr_11.gif]
[Graphics:../Images/index_gr_12.gif]
If there are still other references to the value of data, these would need to be cleared as well.
If you want to locate all references to an expression, you can track down references using methods such as
[Graphics:../Images/index_gr_13.gif]
[Graphics:../Images/index_gr_14.gif]
[Graphics:../Images/index_gr_15.gif]
which reports all of the symbols that include references to the expression data. This sort of thing is rarely necessary, though. In most cases, it is not difficult to find references just by looking at a program, or to set up your program so that unwanted references are not introduced in the first place.


Converted by Mathematica      September 29, 1999 [Prev Page][Next Page]