ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-core:95663] [Ruby master Feature#16290] Add Ruby C API to acquire aligned memory
       [not found] <redmine.issue-16290.20191104091638@ruby-lang.org>
@ 2019-11-04  9:16 ` watson1978
  2019-11-05  1:41 ` [ruby-core:95683] " shyouhei
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 4+ messages in thread
From: watson1978 @ 2019-11-04  9:16 UTC (permalink / raw)
  To: ruby-core

Issue #16290 has been reported by watson1978 (Shizuo Fujita).

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

* 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/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [ruby-core:95683] [Ruby master Feature#16290] Add Ruby C API to acquire aligned memory
       [not found] <redmine.issue-16290.20191104091638@ruby-lang.org>
  2019-11-04  9:16 ` [ruby-core:95663] [Ruby master Feature#16290] Add Ruby C API to acquire aligned memory watson1978
@ 2019-11-05  1:41 ` shyouhei
  2019-11-05  7:26 ` [ruby-core:95688] " naruse
  2019-11-05  7:46 ` [ruby-core:95689] " shyouhei
  3 siblings, 0 replies; 4+ messages in thread
From: shyouhei @ 2019-11-05  1:41 UTC (permalink / raw)
  To: ruby-core

Issue #16290 has been updated by shyouhei (Shyouhei Urabe).


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?

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

* 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/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [ruby-core:95688] [Ruby master Feature#16290] Add Ruby C API to acquire aligned memory
       [not found] <redmine.issue-16290.20191104091638@ruby-lang.org>
  2019-11-04  9:16 ` [ruby-core:95663] [Ruby master Feature#16290] Add Ruby C API to acquire aligned memory watson1978
  2019-11-05  1:41 ` [ruby-core:95683] " shyouhei
@ 2019-11-05  7:26 ` naruse
  2019-11-05  7:46 ` [ruby-core:95689] " shyouhei
  3 siblings, 0 replies; 4+ messages in thread
From: naruse @ 2019-11-05  7:26 UTC (permalink / raw)
  To: ruby-core

Issue #16290 has been updated by naruse (Yui NARUSE).


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.
It sounds reasonable to make public this implementation.
https://github.com/ruby/ruby/blob/853d91a04a4d133fc90b35c90570dc1c656a7922/gc.c#L9736-L9761


We don't have mmap(2) wrapper.

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

* 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/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [ruby-core:95689] [Ruby master Feature#16290] Add Ruby C API to acquire aligned memory
       [not found] <redmine.issue-16290.20191104091638@ruby-lang.org>
                   ` (2 preceding siblings ...)
  2019-11-05  7:26 ` [ruby-core:95688] " naruse
@ 2019-11-05  7:46 ` shyouhei
  3 siblings, 0 replies; 4+ messages in thread
From: shyouhei @ 2019-11-05  7:46 UTC (permalink / raw)
  To: ruby-core

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/

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-11-05  7:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <redmine.issue-16290.20191104091638@ruby-lang.org>
2019-11-04  9:16 ` [ruby-core:95663] [Ruby master Feature#16290] Add Ruby C API to acquire aligned memory watson1978
2019-11-05  1:41 ` [ruby-core:95683] " shyouhei
2019-11-05  7:26 ` [ruby-core:95688] " naruse
2019-11-05  7:46 ` [ruby-core:95689] " shyouhei

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).