Questions about RAM usage, including optimizing memory use, avoiding and fixing leaks and releasing unused memory.

learn more… | top users | synonyms

7
votes
3answers
400 views

How to fix this memory leak

I am using halirutan's code in this thread to unflatten a list. It works very well but the problem is that the Module's local function f is not deleted when the ...
1
vote
1answer
44 views

Write memory usage to file in script

Is there a way to write the MemoryInUse into a file once a minute? In this Debugging memory leaks question there is a neat dynamic diagram showing the MemoryInUse over time. My problem is that I run ...
3
votes
1answer
32 views

OpenCLLink eating up all host memory

I am calling lots of OpenCL functions from Mathematica. The problem is that the memory the kernel uses grows and grows until the RAM is fully occupied. I have created a small piece of code to ...
2
votes
1answer
30 views

Why does MemoryConstrained have an upper limit on the constraint?

When evaluating MemoryConstrained for a large memory limit: MemoryConstrained[Print["aaa"],10^10] I get: ...
3
votes
1answer
124 views

Writing results directly to file

I am trying to find all simple paths in a large directed graph (542 vertex, density ~ 5%) between two nodes. For this purpose, I use the algorithm from this thread. Unfortunately, my computer is ...
0
votes
0answers
55 views

Memory issue when using LinearSolve

When I use LinearSolve to solve a large system of linear equations where the left hand side is a matrix and the right hand side is a vector, the process takes a ...
0
votes
0answers
14 views

Restoring a Mathematica session without notebook interface [duplicate]

It happens all the time that I close my Mathematica session and later I regret that I have done so, because there are many things that I would like to check. I would like to know if there is a way to ...
2
votes
0answers
61 views

Problem with files size

I need to work with long time series, but I notice that this generates huge files that Mathematica doesn't handle well at all: even opening/saving one of this files is difficult, and the kernel quits ...
1
vote
1answer
93 views

Parallel evaluation and memory use

I have never used Mathematica's parallel evaluation before and have some trouble getting it to work properly. For the record, I am running Mathematica 9 on Linux with an Intel Core i7 processor (4 ...
2
votes
2answers
68 views

Random Choice: List Format & Minimizing Memory Use

This is a two part question, and for that I apologize.. but they're related! Here's what I'm working with: ...
1
vote
0answers
49 views

Memory consumed by NMaximize with NDSolve

I'm using NMaximize on a function that calls NDSolve, and running out of memory. I created the following minimal example that (I ...
8
votes
1answer
133 views

AndersonDarlingTest and DistributionFitTest Leaking Memory

I believe AndersonDarlingTest and probably all other tests are keeping a copy of data somewhere and not freeing it: ...
0
votes
0answers
87 views

Heavy duty operations, RAM, and Readyboost

I occasionally work with large 3D arrays and found that with calculations that take a long time, Mathematica completely fills my available RAM (6056 MB minus other active operations [mostly svchost]), ...
9
votes
2answers
462 views

Memory leak issues

I am working with noncommuting objects and basically I am using Mathematica to sort large expressions by normal ordering and simplifying them. To this end, I first create an object called ...
10
votes
3answers
219 views

Can I return lists with different dimensions from a compiled function?

Sometimes I'll need several lists with different dimensions to be returned by a compiled function, but compiled function will fail if an irregular list contained: ...
6
votes
2answers
282 views

Memory management and speed for Fast GCD

Let's say that we have some $300\,\text{K}$ digits (arbitrary function) and want to trial factor with $100{,}000{,}000$ first prime numbers. ...
7
votes
2answers
163 views

How to un-eat memory?

Consider this code: ...
2
votes
0answers
53 views

How to save all variables in the workspace into a file? [duplicate]

I did some time consuming computation and obtained a lot of arrays and variables; however after restart the Mathematica Kernel, all these computational results disappeared. How can I save all these ...
14
votes
1answer
258 views

How to constrain memory usage on HPC?

I found the performance of built-in function MemoryConstrained is very poor. It stops the evaluation after the memory limit has already been exceeded greatly than ...
4
votes
2answers
122 views

Can one use Map during Expand?

Can one Map a simplifying function to the summands of an Expand before fully expanding the expression in question first? ...
5
votes
2answers
134 views

Remove versus ClearAll

What is the difference between Remove and ClearAll? I thought that "not being recognized by Mathematica", which is the effect ...
6
votes
1answer
110 views

Is there a version of Together that doesn't cancel common factors?

I'm running code that produces a long combination of rational functions with free constants that need to be tuned such that the combination vanishes. My current method is to put the combination over ...
13
votes
2answers
181 views

Module trash collection behaviour

I have asked this question before on the Wolfram community forum (http://community.wolfram.com/groups/-/m/t/83845?p_p_auth=Gxoxe65B) but not with great success. Module creates temporary variables of ...
5
votes
1answer
77 views

Does Share have any side effect?

According to the documentation, Share[expr] changes the way expr is stored internally, to try and minimize the amount of ...
12
votes
1answer
205 views

Unpacked eigenvectors of complex matrices

I want to calculate eigenvectors of a Hermitian matrix. For example ...
0
votes
0answers
65 views

kernel shuts down during listplot [duplicate]

In at least the following situations, I have experienced that the kernel has shut down during evaluation. The thing is that there is no message at all when it shuts down. ...
1
vote
0answers
61 views

NMinimize memory consumption problem in Mathematica 9 vs. 7 & 8

I am having trouble using NMinimize in Mathematica 9 - Memory consumption overflows. The same NMinimize command, with the same ...
4
votes
1answer
80 views

Memory usage of timeseries - lists of {Integer32, Real32}

A list of {Integer32, Real32} items in Mathematica seems to use 12-times as much memory than the C equivalent array of structs. ...
1
vote
0answers
49 views

Memory Leak while running Animate/Manipulate/Export [duplicate]

While looking into building a simulation for an ant colony, I started encountering some memory leakage issues. ...
5
votes
0answers
147 views

How can I find the source of a memory leak?

I found a really weird issue using NDSolve`ProcessEquations inside module. We start by setting HistoryLength to 0. After this we define a function which takes in an integer and creates a Table of ...
5
votes
0answers
159 views

NDSolve and memory usage

After some googling, i've found similar problems around, but didn't find a 100% satisfactory answer, so let me ask here: I'd like to solve a 1+1 problem using the method of lines. In spherical ...
2
votes
0answers
114 views

Memory problem with producing complex graphics of general type

The problem I am about to ask has appeared once here: Memory Leak in Frontend - anyone know a workaround?. However, in this question I would like to put it in a bit different context. Problem recipe: ...
18
votes
4answers
363 views

Running out of memory when partitioning an image with ImagePartition

I have an Image3D object of image type "Bit16" with the dimensions 1472 x 1472 x 1472 that I would like to split into small image cubes of dimension 64 x 64 x 64 ...
2
votes
0answers
94 views

Clearing memory of a subkernel in a Do loop

I have a Do loop, which saves data directly to a .txt file. However when I leave it running for long periods of time the RAM ...
2
votes
1answer
66 views

Strange response with dynamic texture and MousePosition

I built a cubic, then use MousePosition together with GUIScreenShot to take a floating region with fixed size (200*200) on the ...
1
vote
0answers
123 views

CUDALink ran out of available memory

I have a problem with automatic GPU memory management when using CUDA. The situation is the following: I create a simple CUDA function that operates on a 2D array (image), which does not take much ...
2
votes
2answers
190 views

How to pick out specific parts of the solution of a differential equation efficiently?

I'm trying to solve a set of differential equations (in parallel) and then select specific parts of the solution. What I have at the moment (see below-I've simplified the differential equations, in ...
2
votes
3answers
107 views

Accessing temporary value of a Nest evaluation

The function Nest[] must store the temporary values in the memory somewhere (those values that would form the entries of the list which is returned by the ...
5
votes
1answer
194 views

Clear and Unset doesn't free memory

Example: Try this example only if you have > 4G ram d = 2000; f[x_, y_, d_] = Sum[Subscript[a, i, j]*x^i*y^j, {i, 0, d - 1}, {j, 0, d - i}]; Then ...
8
votes
1answer
166 views

Where is my memory? — LibraryLink never returns the memory

This is an example LibaryLink code from Mathematica documentation, which takes an integer and return an integer list: ...
4
votes
2answers
245 views

Memory efficient generation and selection of tuples

The short of this question: I need to find a bunch of n-tuples of {0,1} which do not fail to satisfy a set of (non-linear polynomial) equations, without hogging up all of my memory by trying to ...
6
votes
2answers
141 views

Giving JLink Huge Memory by Default

I have noticed that Mathematica makes use of Java by way of JLink, for example, in the extensions such as DatabaseLink and (I think) RLink. It also seems like Java is a first-class citizen for writing ...
2
votes
1answer
158 views

Paging RAM in case of memory shortage issue

Is there some way in Mathematica where I can issue execution of some command with letting Mathematica use my hard disk in case it is short of RAM. It will drastically reduce the speed but I am fine ...
0
votes
0answers
106 views

How can I revise my program to avoid “No more memory available”? [duplicate]

I have a program for calculating a type of list. ...
0
votes
0answers
29 views

Keeping memory to reduce the running time of recursion [duplicate]

I am using the following recursion in Mathematica to compute W[n, 1, s] for given n and s: ...
1
vote
1answer
90 views

Memory handling by ConstantArray

I noticed the following issue when using ConstantArray: a = ConstantArray[0., {10000, 100}]; ByteCount[a] (* 8000152 *) Then ...
0
votes
1answer
105 views

Running out of memory using FindMinimum with ParametricFunctions

I am running a pretty large optimization problem which actually consists of an outer an inner optmization problem. I use ParametricNDSolve for solving a ODE system. When the optimization is done, ...
5
votes
1answer
65 views

How to relate memory usage with occupied positions of SparseArrays?

What is the relation of memory usage of a SparseArray and the number of its occupied positions? Let's say you build a 100.000.000 by 10 element SparseArray. And fill the two position 1/1 and ...
1
vote
0answers
111 views

FindRoot runs out of memory in Windows but not on Mac

I am using FindRoot to find solutions to a large, highly oscillatory equation which I generated using other code. When I run ...