[ruby-core:95689] [Ruby master Feature#16290] Add Ruby C API to acquire aligned memory

From: shyouhei@...
Date: 2019-11-05 07:46:10 UTC
List: ruby-core #95689
Issue #16290 has been updated by shyouhei (Shyouhei Urabe).


naruse (Yui NARUSE) wrote:
> shyouhei (Shyouhei Urabe) wrote:
> > I'm not in favor of this.  There are many ways to allocate a memory region, like mmap(2).  Do we have to provide ruby counterparts for every and all of them?
> 
> rb_aligned_malloc uses 5 underlying implementations.
> It's hard to make C-extension developer to re-develop this.

In case of this request, ImageMagick already _does_ have aligned allocator.  If we provide one we would use any of 5 backends but that is not required at all.  They already have it.  What is wanted is a way to notify ruby about their memory usage.

----------------------------------------
Feature #16290: Add Ruby C API to acquire aligned memory
https://bugs.ruby-lang.org/issues/16290#change-82477

* Author: watson1978 (Shizuo Fujita)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
----------------------------------------
Related to https://github.com/ruby/ruby/pull/2614

I have required to acquire aligned memory in Ruby C-extension library (https://github.com/rmagick/rmagick/pull/832).
I want an API that notifies acquired size to Ruby GC.

Of course, I know that we can implement a similar function in extension library using rb_gc_adjust_memory_usage().
However, if Ruby have the API, we can easily use it in some extension libraries.





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

Unsubscribe: <mailto:[email protected]?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>

In This Thread

Prev Next