[#87847] undefined symbol: mjit_init_p — Leam Hall <leamhall@...>

I pulled Ruby trunk on 3 Jul and am now getting errors similar to the

10 messages 2018/07/07

[#88088] [Ruby trunk Misc#14937] [PATCH] thread_pthread: lazy-spawn timer-thread only on contention — normalperson@...

Issue #14937 has been reported by normalperson (Eric Wong).

9 messages 2018/07/24

[ruby-core:87851] [Ruby trunk Feature#14426] [PATCH] openssl: reduce memory allocation in OpenSSL::Buffering#do_write

From: janko.marohnic@...
Date: 2018-07-07 17:07:05 UTC
List: ruby-core #87851
Issue #14426 has been updated by janko (Janko Marohnić).

File openssl-memory-allocation.patch added

The patch got outdated in the latest trunk, so I updated it again. It's a really small change with big impact on memory usage when uploading files.

----------------------------------------
Feature #14426: [PATCH] openssl: reduce memory allocation in OpenSSL::Buffering#do_write
https://bugs.ruby-lang.org/issues/14426#change-72871

* Author: janko (Janko Marohnić)
* Status: Assigned
* Priority: Normal
* Assignee: rhenium (Kazuki Yamaguchi)
* Target version: 
----------------------------------------
When writing data to an SSLSocket, there are a lot of, in my opinion, unnecessary strings being allocated, concretely in OpenSSL::Buffering#do_write.

When the buffer would be written, it would always be copied into a new string first, regardless of whether the write was partial or not. And in case of partial writes, it's not necessary to create copies of remaining data, we could just use the `String[from, length] = ""` trick immediately which modifies the string in-place.

I also thought that splitting writes on newlines was adding unnecessary memory allocations, so I removed that.

I tested uploading a 5MB file using HTTP.rb, and memory allocation went from 7.7 MB to 0.2 MB with this change.

~~~ ruby
require "http"
require "memory_profiler"
require "stringio"

body = StringIO.new("a" * 5*1024*1024)

MemoryProfiler.report do
  HTTP.post("https://example.com", body: body)
end.pretty_print
~~~


---Files--------------------------------
openssl-memory-allocation.patch (913 Bytes)


-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>

In This Thread

Prev Next