Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backport 37ed86fd3c798e298fad9db6e7df1f3f45e1e03b #10248

Merged
merged 1 commit into from
Mar 14, 2024

Conversation

nurse
Copy link
Member

@nurse nurse commented Mar 14, 2024

fix [Bug #20161]

	Fix memory leak in regexp grapheme clusters

	[Bug #20161]

	The cc->mbuf gets overwritten, so we need to free it to not leak memory.

	For example:

	    str = "hello world".encode(Encoding::UTF_32LE)

	    10.times do
	      1_000.times do
	        str.grapheme_clusters
	      end

	      puts `ps -o rss= -p #{$$}`
	    end

	Before:

	    15536
	    15760
	    15920
	    16144
	    16304
	    16480
	    16640
	    16784
	    17008
	    17280

	After:

	    15584
	    15584
	    15760
	    15824
	    15888
	    15888
	    15888
	    15888
	    16048
	    16112
	---
	 regparse.c | 3 ++-
	 1 file changed, 2 insertions(+), 1 deletion(-)
@nurse nurse added the Backport label Mar 14, 2024
@nurse nurse enabled auto-merge March 14, 2024 07:20
@nurse nurse changed the title backport ticket=20161 Backport 37ed86fd3c798e298fad9db6e7df1f3f45e1e03b Mar 14, 2024
@nurse nurse added this pull request to the merge queue Mar 14, 2024
Merged via the queue into ruby:ruby_3_3 with commit 577f9c7 Mar 14, 2024
98 checks passed
@nurse nurse deleted the backport---ticket=20161 branch March 14, 2024 09:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1 participant