Questions tagged [memory]

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

Filter by
Sorted by
Tagged with
6 votes
1 answer
189 views

How to remember evaluation across sessions?

I am performing a very time-consuming symbolic calculation. When I reopen a saved Mathematica notebook, it takes quite a long time to evaluate. Is there an option to tell Mathematica to remember the ...
user avatar
  • 61
1 vote
0 answers
83 views

Why Mathematica don't set \$RecursionLimit and \$IterationLimit very big by default? [closed]

For my current program in Mathematica, sometimes I will encounter an error regarding \$IterationLimit and \$RecursionLimit. So I always set these two numbers to very large at the starting of every ...
user avatar
8 votes
1 answer
262 views

Working around Memory Leak from HermiteDecomposition

I am running into an issue where HermiteDecomposition seems to leak memory, but only from certain matrices ...
user avatar
0 votes
1 answer
75 views

Memory problems when fitting large (correlated) datasets

I am trying to fit some complicated function that depends on 18 parameters. The problematic is that I have a large correlated dataset (336 points). When fitting, for simplicity, taking only the ...
user avatar
  • 701
3 votes
0 answers
72 views

JoinAcross Memory Leak

I believe JoinAcross may have a memory leak but would appreciate some help looking at it. It appears to be small when used just once but when iterated a lot it eventually crashes my wolframscripts. I'...
user avatar
  • 572
3 votes
1 answer
126 views

How to optimize ContourPlot3D evaluation?

I tried to plot a certain 3D sine function: ContourPlot3D[(Sin[x^2] + 2) * (Sin[y^2] + 2) * (Sin[z^2] + 2) , {x, -2, 2}, {y, -2, 2}, {z, -2, 2}] but ran into an ...
user avatar
  • 333
2 votes
0 answers
44 views

Free up used Memory

When using FunctionCompile[] to generate a large matrix of ranges there seems to be no way of recovering memory even though the variables are either out of scope or overwritten. I am aware that there ...
user avatar
  • 101
0 votes
0 answers
33 views

problem In NMinimize and large number of variables and constraints

I Try to solve TSP problem by writing the linear program of this problem (I know that FindShortestTour Function can solve it but I need to solve it manually), I generate the linear program correctly ...
user avatar
  • 73
0 votes
0 answers
95 views

See variable as byte

I see variable v is occupying 112 bytes of my RAM. v = {3, 5, 7}; ByteCount[v] 112 Then how to see the content of the 112 bytes?...
user avatar
  • 2,451
1 vote
0 answers
48 views

Erratic behavior retrieving large data (several tens of gigabytes) that has been serialized by Mathematica

Hardware: PC with 256GB RAM OS: Windows 10 Mathematica: Version 13.0.1 One of my projects has led to the creation of a SparseArray whose ByteCount is ~ 35GB in RAM. At the time of creation the ...
user avatar
  • 2,024
5 votes
1 answer
114 views

Unexpected high memory consumption using out-of-core NetTrain

I'm working on training a neural network on an image dataset. There are 14k images and each image contains 3x150x150 pixels. I have built a generator function following the approach in Training on ...
user avatar
4 votes
1 answer
195 views

Memory use buildup when solving PDE multiple times

Mathematica V 13.0 Mac OS X ARM (64-bit) - MacBook Pro 13" M1 processor macOS Big Sur 11.6.2 I am solving a PDE numerically and have noticed that memory use keeps piling up if I execute the same ...
user avatar
0 votes
2 answers
99 views

Memory preserving computation in chunks

I would like to do the following: Make a table tab1={{i1,b1,c1,d1},{i1,b1,c1,d2},...,{i1,b1,c2,d1},...,{i1,b2,c1,d1},...{i2,b1,c1,d1},...} for the given range imin < i < imax. Make some ...
user avatar
  • 3,542
8 votes
3 answers
643 views

How to clear up RAM without exiting kernel?

I am trying to implement the code which generates some table, works with it, extracts some numbers, add them to some other table, then clears the table (only the table and not the other elements of ...
user avatar
  • 3,542
11 votes
2 answers
626 views

Out of memory when computing a coefficient of a large symmetric polynomial

...
user avatar
3 votes
0 answers
76 views

How to allocate more physical memory to Mathematica?

My MacBook Pro (2019) has 32 GB of memory, but when I work with a large array reaching 1 GB of storage, the Mathematica Kernel only gets a little more of 1 GB, but gets allocated a lot of virtual ...
user avatar
  • 1,196
2 votes
0 answers
83 views

How to avoid running out of memory in ParallelMap?

I am mapping a function over a list of length 77237. ParallelMap[AnalyzeZernikeRecord,records] The result of each function application is just a list of 12 numbers....
user avatar
  • 1,857
0 votes
0 answers
36 views

How can I prevent functions and variables from being automatically cleared when I close Mathematica? [duplicate]

The following happens with every notebook I make: I define functions and variables. When I quit Mathematica and reopen the notebook, all of those definitions have been cleared. The functions and ...
user avatar
2 votes
1 answer
59 views

What circumstances would cause memory to inflate while packing the sublists of a ragged matrix?

I'm working with a ragged matrix of considerable size (ByteCount = 47749114088; Length = 563529128). I had seen a suggestion mentioned in other questions (here on StackExchange), that one might be ...
user avatar
  • 2,024
2 votes
2 answers
109 views

Finding IntegerPartitions[252] with no zero and no duplicates

Well, I am trying to execute the following code: ...
user avatar
  • 1,723
5 votes
0 answers
60 views

Memory leak in FindMinValue?

I was running some geometric optimisation code today using FindMinValue and for some reason at one point the memory usage goes upwards of 14GB, making the kernel ...
user avatar
0 votes
0 answers
47 views

Encountered SystemException["MemoryAllocationFailure"] while trying to plot a function

I have an expression that simplifies to the following expression, which I denote as a function X. ...
user avatar
2 votes
1 answer
87 views

How does Leafcount work? [closed]

I am curious about how LeafCount works because when I count the number of leaves in my solution to a Wolfram Challenge, I get a much smaller result than those listed on the leaderboard for Multiples ...
user avatar
1 vote
0 answers
44 views

How to optimize Code for Wolfram Challenges?

I am wondering if anyone who has knowledge of optimizing programs in the Wolfram language has any advice on how to optimize the following quantities of programs written to solve Wolfram Challenges. I ...
user avatar
4 votes
1 answer
129 views

Export is not clearing memory

Version: all 12.x OS: Windows 10 and MacOS I am having an issue with Export not clearing memory after it is done with exporting to an .mx file. I have reviewed other posts concering memory issues with ...
user avatar
4 votes
0 answers
47 views

Function for identifying wasteful cells (e.g. needless large graphics) - does this exist already?

I noticed that I have a bad habit of saving notebooks with huge graphics in them and it's starting to impact storage and load times a little much. I figured I could make a routine to point out the few ...
user avatar
  • 611
8 votes
0 answers
139 views

ResourceFunction memory leak?

Bug introduced in 12.3 or earlier and persisting through 12.3.1 or later ResourceFunction seems to cause a substantial memory leak when called many times. e.g. to ...
user avatar
  • 611
3 votes
1 answer
184 views

Running out of memory when exporting at high ImageResolution

...
user avatar
  • 23.1k
4 votes
0 answers
59 views

On auto-limiting memory and other resource usage

I play fast and loose with my evaluations, so try to calculate something much too large at least once a day. Life has gotten a lot easier ever since I started setting: ...
user avatar
  • 611
0 votes
2 answers
82 views

Writing a wrapper function computing the memory in use

Is there any way I can write a wrapper that wraps around a piece of code and evaluates how much memory has been used after the execution? Ideally I would like a function that performs the following ...
user avatar
0 votes
0 answers
46 views

A Function of Arguments or a Function of a List of those Arguments – Which is Recommended?

Which is recommended from a programming perspective and has better performance in memory and speed given guaranteed identical output – a function taking many arguments and then referring to those ...
user avatar
3 votes
2 answers
89 views

Passing Arguments or Passing a List and Referring to its Parts – Which Gives Better Performance?

Which is better for optimizing speed, memory, and coding "safety" – passing arguments to a function or passing a list to the function and call the list's parts? That is, which of the ...
user avatar
1 vote
1 answer
117 views

Running out of RAM because of a loop

I'm working with some Voronoi diagrams, and I want to find the perimeter and area of each polygon in it. I think I accomplish that, but I have a problem with RAM memory management. This is a ...
user avatar
  • 13
4 votes
0 answers
138 views

How can I free GPU memory allocated with NetTrain

When I train a neural network with NetTrain[..., TargetDevice->"GPU"], wolfram's neural network code automatically allocates memory on my GPU for my ...
user avatar
0 votes
0 answers
62 views

Calculating my code for higher values of `k`?

How do I calculate the mean of A for higher values of k ...
user avatar
  • 199
0 votes
0 answers
41 views

Clear a variable on parallel kernels

I am running the following code: SetSharedVariable[a]; a= {}; x = 1; ParallelDo[ x += i; AppendTo[a, x] , {i, 1, 3}] I want to define variable x outside the ...
user avatar
0 votes
0 answers
53 views

How is it possible that $SystemMemory is set to zero?

For one of my Windows machines (Mathematica 12.x.x, only one of them) apparently $SystemMemory returns 0 (zero). I'm unable to do anything with that, since ...
user avatar
0 votes
0 answers
75 views

Memory leak during parallel computing

I have a memory leak during parallel computing. The problem seems to be in how a large variable is passed to kernels but I can't think of anything to fix that. Consider this simplified example: ...
user avatar
1 vote
0 answers
71 views

Unpacking array message in Compile and Fold

Suppose, I have a nonlinear map, like this: ...
user avatar
  • 99
1 vote
1 answer
62 views

Using With[] vs. Using a Pure Function for Constants

There are many cases where I am conflicted over using With[] versus using pure functions when dealing with constants, knowing the output is the same either way. For ...
user avatar
0 votes
0 answers
38 views

Handling large data generated by a script file (using parallelization in Mathematica)

I want to write a script file Script_file.m which I am going to run on a server and collect all the data in a file named ...
user avatar
  • 13
3 votes
3 answers
81 views

How to avoid duplicating the same data on the master kernel into each subkernel?

I have found the same question Avoid copying memory for each subkernel However, there was no proper answer. This question was posted in 2015. Now it has been 6 years. So, I wish to find the solution ...
user avatar
1 vote
1 answer
28 views

Is there a better way : solutions to integer equation

I have the following code which solves for Integers the equation $$a_1+a_2+a_3+a_4+b_1+b_2+b_3+b_4+c_1+c_2+c_3+c_4=tot$$ with $$ -4<a_i\in \mathbb{Z}<4$$ $$ -7<b_i\in \mathbb{Z}<7$$ $$ -4&...
user avatar
  • 912
1 vote
0 answers
34 views

Clear variables on window close

I'm using DynamicModule[{ var1, var2 }, CreateDialog[ (*some code here*) ]] In order to be able to deal with memory isolation for multiple copies of a program ...
user avatar
  • 53
0 votes
0 answers
54 views

Memory leak while using ParallelTable

I am populating a table using ParallelTable. The entries of this table are given by a function written as a module, which depends on several modules itself. Here's a rough skeleton of the code: ...
user avatar
  • 343
1 vote
2 answers
339 views

Extremely memory consuming Expand

Expand floods all my 64GB RAM in MMA 12.1 (Windows) just by sorting the powers of 16 variables. Somebody with >64GB RAM could run it. A memory saving ...
user avatar
3 votes
0 answers
92 views

How to reduce size (ByteCount) of a number?

How do I reduce the memory, reserved for a number? ...
user avatar
  • 91
0 votes
0 answers
51 views

Why baseline kernel and FE memory munch?

I was surprised to learn how much of my session memory consumption is due to baseline claims by the Kernel and FrontEnd. Using 12.1.0.0 on Win10/64/Pro. Here's an example: ...
user avatar
0 votes
0 answers
58 views

Implementation uses too much memory

Code shows memory error for higher values of the variable Numofbits. I can only go until 4. ...
user avatar
3 votes
3 answers
115 views

Memory isolation autochecker

I'm working on a project in which I'm putting everything in modules to make sure I can run multiple instances without them interfering with each other, however I'd like to have it automatically let me ...
user avatar
  • 69

1
2 3 4 5
9