caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Christopher Kauffman <kauffman@cs.umn.edu>
To: OCaml <caml-list@yquem.inria.fr>
Subject: Re: [Caml-list] Garbage collection and caml_adjust_gc_speed - Problem in Bigarray
Date: Thu, 31 Aug 2006 16:08:23 -0500	[thread overview]
Message-ID: <44F74FC7.909@cs.umn.edu> (raw)
In-Reply-To: <44F7018A.7040905@cs.umn.edu>

After some very helpful advice from Shivkumar Chandrasekaran, I have located the 
source of the problem. In my code, a very frequent operation is to take a slice 
of a matrix or array (a column of a matrix representing the X-coordinates of 
some atoms for instance) and perform some operations on that slice. This is 
supported in the Bigarray library with the 'slice_left' function (for 
fortran_layout arrays) and in Lacaml with Mat.col function. Unfortunately, using 
this operation results in the following sequence of underlying C-function calls 
in ocaml-3.09.2/otherlibs/bigarray/bigarray_stubs.c:

bigarray_slice() -> alloc_bigarray() -> alloc_custom() -> caml_adjust_gc_speed()

So even though there is no allocation of new underlying data, taking a slice 
creates custom data to manage the new alias which triggers GC adjustment. I am 
certainly not familiar with the inner workings of the garbage collector, but 
this seems like undesirable behavior as much efficiency is lost for no apparent 
reason.

This now seems like an issue with the Bigarray library. Please advise me on the 
protocol for submitting this issue that it might be considered for correction in 
a future release.

Cheers,
Chris

PS - Thanks again to Shivkumar!


  reply	other threads:[~2006-08-31 21:08 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-29  4:16 Garbage collection and caml_adjust_gc_speed Christopher Kauffman
2006-08-29 15:20 ` [Caml-list] " Damien Doligez
2006-08-29 18:37   ` Christopher Kauffman
2006-08-31 15:34     ` Christopher Kauffman
2006-08-31 21:08       ` Christopher Kauffman [this message]
2006-09-01 17:06         ` [Caml-list] Garbage collection and caml_adjust_gc_speed - Problem in Bigarray David MENTRE

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=44F74FC7.909@cs.umn.edu \
    --to=kauffman@cs.umn.edu \
    --cc=caml-list@yquem.inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 NNTP newsgroup(s).