← Back to team overview

hugin-devs team mailing list archive

[Bug 822690] Re: automatic detection/use of memory.

 

While I agree that this could be done, average users simply won't. In the coming years, more and more normal end-users  will have 8G and more RAM in their PC. It is up to enblend to use a sensible default. 

For your information: Here is the "default memory buffer to use" code
from "sort" in "coreutils". (in fact it doesn't completely work as it
should, but that's another matter).

----------------------------------------------------------------
/* Return the default sort size.  */
static size_t
default_sort_size (void)
{
  /* Let MEM be available memory or 1/8 of total memory, whichever
     is greater.  */
  double avail = physmem_available ();
  double total = physmem_total ();
  double mem = MAX (avail, total / 8);
  struct rlimit rlimit;

  fprintf (stderr, "default sort size: avail=%fM, total=%fM, mem=%fM\n", 
        avail/1024/1024, total/1024/1024, mem/1024/1024); 
  /* Let SIZE be MEM, but no more than the maximum object size or
     system resource limits.  Avoid the MIN macro here, as it is not
     quite right when only one argument is floating point.  Don't
     bother to check for values like RLIM_INFINITY since in practice
     they are not much less than SIZE_MAX.  */
  size_t size = SIZE_MAX;
  if (mem < size)
    size = mem;
  fprintf (stderr, "size is now: %dM\n", size/1024/1024);
  if (getrlimit (RLIMIT_DATA, &rlimit) == 0 && rlimit.rlim_cur < size)
    size = rlimit.rlim_cur;
  fprintf (stderr, "after rlimit size is now: %dM\n", size/1024/1024);
#ifdef RLIMIT_AS
  if (getrlimit (RLIMIT_AS, &rlimit) == 0 && rlimit.rlim_cur < size)
    size = rlimit.rlim_cur;
#endif

  /* Leave a large safety margin for the above limits, as failure can
     occur when they are exceeded.  */
  size /= 2;
  fprintf (stderr, "after margin size is now: %dM\n", size/1024/1024);

#ifdef RLIMIT_RSS
  /* Leave a 1/16 margin for RSS to leave room for code, stack, etc.
     Exceeding RSS is not fatal, but can be quite slow.  */
  if (getrlimit (RLIMIT_RSS, &rlimit) == 0 && rlimit.rlim_cur / 16 * 15 < size)
    size = rlimit.rlim_cur / 16 * 15;
#endif
  fprintf (stderr, "after rlimitrss size is now: %dM\n", size/1024/1024);

  fprintf (stderr, "returning: %dM\n", MAX (size, MIN_SORT_SIZE)/ 1024/1024);
  /* Use no less than the minimum.  */
  return MAX (size, MIN_SORT_SIZE);
}

-- 
You received this bug notification because you are a member of Hugin
Developers, which is subscribed to Enblend.
https://bugs.launchpad.net/bugs/822690

Title:
  automatic detection/use of memory.

Status in Enblend:
  New

Bug description:
  background:

  the default for the -m option is 1024Mb. This means that you'll need
  about 1Gb of swap if your machines has less than 1G of RAM. Fine. When
  you have 1G of RAM, you'll be fine. You'll waste some RAM if you have
  2G, but if you have 4, 8 or 16Gb, enblend will run in a tiny part of
  RAM and leave the rest unused.

  Wishlist:
  Enblend should, when RAM >> 1G, auto-adjust the -m parameter to say 0.75 * RAMSIZE. (limited to 2048 if sizeof (long) == 4)

To manage notifications about this bug go to:
https://bugs.launchpad.net/enblend/+bug/822690/+subscriptions


References