ManimCommunity / ManimCommunity/manim
Investigate large memory usage
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 40.9k
- Forks
- 3.1k
- Avg merge
- 3d 12h
- Merged PRs (30d)
- 25
Description
## Description of bug / unexpected behavior
The following scene:
```py
from manim import *
class Frac(Scene):
def construct(self):
tri = RegularPolygon(n=3, fill_opacity=1, stroke_opacity=0, fill_color=GREEN)
tri.scale(2)
a, b, c = tri.get_vertices()
tri.scale(2)
self.play(FadeIn(tri))
for it in range(7):
A, B, C = tri, tri.copy(), tri.copy()
if it == 0:
B.set_color(BLUE)
C.set_color(RED)
self.play(
AnimationGroup(
C.animate.move_to(c).scale(0.5),
B.animate.move_to(b).scale(0.5),
A.animate.move_to(a).scale(0.5),
lag_ratio=0.5
)
)
tri = VGroup(C, B, A)
tiny_triangles = sorted(tri.family_members_with_points(), key=lambda mob: mob.fill_color.get_hex())
self.play(VGroup(*tiny_triangles).animate(lag_ratio=0.25).set_opacity(0), run_time=3)
self.wait(0.5)
```
uses a large amount of memory. It's worth investigating how exactly this memory is used, and how it can be reduced.
## Expected behavior
## How to reproduce the issue
Code for reproducing the problem
```py
Paste your code here.
```
## Additional media files
Images/GIFs
## Logs
Terminal output
```
PASTE HERE OR PROVIDE LINK TO https://pastebin.com/ OR SIMILAR
```
## System specifications
System Details
- OS (with version, e.g., Windows 10 v2004 or macOS 10.15 (Catalina)):
- RAM:
- Python version (`python/py/python3 --version`):
- Installed modules (provide output from `pip list`):
```
PASTE HERE
```
LaTeX details
+ LaTeX distribution (e.g. TeX Live 2020):
+ Installed LaTeX packages:
FFMPEG
Output of `ffmpeg -version`:
```
PASTE HERE
```
## Additional comments
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Run the provided `Frac.construct` scene and profile memory through the repeated `AnimationGroup`, copying, and final opacity animation. Trace where memory grows and compare it with the scene's progressively nested `VGroup`; done means identifying the source of the large usage and reducing it without changing the demonstrated animation behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- performance
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100