gives the maximum number of bytes used to store all data for the current Wolfram System session.
MaxMemoryUsed[expr]
gives the maximum number of bytes used during the evaluation of expr.
MaxMemoryUsed
gives the maximum number of bytes used to store all data for the current Wolfram System session.
MaxMemoryUsed[expr]
gives the maximum number of bytes used during the evaluation of expr.
Details
- On most computer systems, MaxMemoryUsed[] will give results close to those obtained from external process status requests.
- MaxMemoryUsed[] will not typically account for code space, stack space, or the effects of heap fragmentation.
Examples
open all close allBasic Examples (2)
Show the maximum memory used during a session:
MaxMemoryUsed[]See how much the maximum memory used increased for a computation:
mmu = MaxMemoryUsed[];NDSolve[{D[u[t, x], t, t] == D[u[t, x], x, x] + Sin[u[t, x]], u[0, x] == Exp[-x ^ 2], (D[u[t, x], t] /. t -> 0) == 0, u[t, -10] == u[t, 10]}, u, {t, 0, 10}, {x, -10, 10}]MaxMemoryUsed[] - mmuScope (1)
View the memory in current use and the maximum memory used thus far in the session:
{MaxMemoryUsed[], MemoryInUse[]}View the additional memory used during a computation:
MaxMemoryUsed[Range[10 ^ 7]]For this trivial computation, the memory used is just slightly above the size of the result:
Range[10 ^ 7]//ByteCountThe maximum memory used by the session increased to the memory in use plus the maximum memory used by the computation:
{MaxMemoryUsed[], MemoryInUse[]}See Also
MemoryInUse ByteCount MemoryAvailable MemoryConstrained
Function Repository: TimeMemoryUsed EchoPerformance
Tech Notes
Related Guides
History
Introduced in 1988 (1.0)
Text
Wolfram Research (1988), MaxMemoryUsed, Wolfram Language function, https://reference.wolfram.com/language/ref/MaxMemoryUsed.html.
CMS
Wolfram Language. 1988. "MaxMemoryUsed." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/MaxMemoryUsed.html.
APA
Wolfram Language. (1988). MaxMemoryUsed. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/MaxMemoryUsed.html
BibTeX
@misc{reference.wolfram_2026_maxmemoryused, author="Wolfram Research", title="{MaxMemoryUsed}", year="1988", howpublished="\url{https://reference.wolfram.com/language/ref/MaxMemoryUsed.html}", note=[Accessed: 12-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_maxmemoryused, organization={Wolfram Research}, title={MaxMemoryUsed}, year={1988}, url={https://reference.wolfram.com/language/ref/MaxMemoryUsed.html}, note=[Accessed: 12-June-2026]}