Skip to content

[OPTIMIZATION] Fix a memory leak in the Freeplay Menu#6615

Merged
Hundrec merged 1 commit intoFunkinCrew:dummy/develop-v0.8.1from
KoloInDaCrib:awesome-capsule-rendering
Feb 3, 2026
Merged

[OPTIMIZATION] Fix a memory leak in the Freeplay Menu#6615
Hundrec merged 1 commit intoFunkinCrew:dummy/develop-v0.8.1from
KoloInDaCrib:awesome-capsule-rendering

Conversation

@KoloInDaCrib
Copy link
Copy Markdown
Contributor

@KoloInDaCrib KoloInDaCrib commented Dec 28, 2025

Linked Issues

None, I think? I feel like a memory leak like this must've been reported before.

Description

Hyper told me that his Tracy session revealed that the memory leak happening from doing anything in Freeplay stemmed from a bunch of drawQuad calls, He suggested using quad batching to fix this. This PR utilizes that by implementing a group that changes how the capsules are rendered, rendering an element type per viable capsule before moving onto the next element.

The code for this was adopted from MaybeMaru's implementation that they showcased a long time ago, just modified for funkin's codebase, hence why they're one of the co-authors.

Screenshots/Videos

who.up.batching.they.quad.mp4

@github-actions github-actions Bot added size: medium A medium pull request with 100 or fewer changes. status: pending triage Awaiting review. pr: haxe PR modifies game code. and removed status: pending triage Awaiting review. size: medium A medium pull request with 100 or fewer changes. labels Dec 28, 2025
@Hundrec Hundrec added status: pending triage Awaiting review. type: optimization Involves a performance issue or a bug which causes lag. topic: freeplay Related to the operation of the Freeplay menu. labels Dec 28, 2025
@DustedDustin
Copy link
Copy Markdown

OH MY GOD, FINALLY?

Copy link
Copy Markdown
Contributor

@NotHyper-474 NotHyper-474 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's peak...

8mb.video-Pqq-FHiTHy1R.mp4

@VirtuGuy
Copy link
Copy Markdown
Contributor

8mb.video-Pqq-FHiTHy1R.mp4

How exactly do you get videos like this?

@NotHyper-474
Copy link
Copy Markdown
Contributor

8mb.video-Pqq-FHiTHy1R.mp4

How exactly do you get videos like this?

I used RenderDoc to dissect a frame and recorded it using OBS

@MightyTheArmiddilo
Copy link
Copy Markdown
Contributor

It's peak...
8mb.video-Pqq-FHiTHy1R.mp4

And it's all a good 31 FPS! (According to the debug display)

@NotHyper-474
Copy link
Copy Markdown
Contributor

And it's all a good 31 FPS! (According to the debug display)

That's because it captured it when the game was minimized and minimizing it lowers the FPS to 30 lol

@AbnormalPoof AbnormalPoof added status: reviewing internally Under consideration and testing. and removed status: pending triage Awaiting review. labels Dec 29, 2025
@Hundrec Hundrec added the size: medium A medium pull request with 100 or fewer changes. label Dec 30, 2025
@VirtuGuy
Copy link
Copy Markdown
Contributor

Is it just me or does this make freeplay open faster?

Copy link
Copy Markdown
Contributor

@TechnikTil TechnikTil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh my god YES!!

@RealBoyfriendFNF
Copy link
Copy Markdown

Emoji what the shit

Co-Authored-By: Hyper_ <40342021+NotHyper-474@users.noreply.github.com>
Co-Authored-By: Mario Hernando <97055307+MaybeMaru@users.noreply.github.com>
@Hundrec Hundrec force-pushed the develop branch 2 times, most recently from 3829dcb to 5805c31 Compare February 1, 2026 03:24
@Hundrec Hundrec linked an issue Feb 3, 2026 that may be closed by this pull request
2 tasks
@Hundrec Hundrec changed the base branch from develop to dummy/develop-v0.8.1 February 3, 2026 04:23
@Hundrec Hundrec added status: accepted PR was approved for contribution. If it's not already merged, it may be merged on a private branch. and removed status: reviewing internally Under consideration and testing. labels Feb 3, 2026
@Hundrec Hundrec added this to the 0.8.2 milestone Feb 3, 2026
@Hundrec Hundrec merged commit 1104d81 into FunkinCrew:dummy/develop-v0.8.1 Feb 3, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr: haxe PR modifies game code. size: medium A medium pull request with 100 or fewer changes. status: accepted PR was approved for contribution. If it's not already merged, it may be merged on a private branch. topic: freeplay Related to the operation of the Freeplay menu. type: optimization Involves a performance issue or a bug which causes lag.

Development

Successfully merging this pull request may close these issues.

Bug Report: Memory leak in Freeplay menu

9 participants