emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Question about mmap buffers


From: Fabrice Popineau
Subject: Question about mmap buffers
Date: Fri, 25 Apr 2014 11:20:36 +0000 (UTC)
User-agent: Loom/3.14 (http://gmane.org/)

I'm in the process of revamping memory allocation for Win32 and adding 
virtual memory allocation support for buffers.

Reading the code in src/buffer.c, I wonder about the mmap_set_vars() 
function.
This function sets the beginning of text address to NULL before dumping,
and later in init_buffer() the same address is tested for being NULL, in 
which case the buffer memory is allocated.

Why can't this be written as the Win32 code below:

void
init_buffer (void)
{
  char *pwd;
  Lisp_Object temp;
  ptrdiff_t len;

#ifdef USE_MMAP_FOR_BUFFERS
 {
   /* When using the ralloc implementation based on mmap(2), buffer
      text pointers will have been set to null in the dumped Emacs.
      Map new memory.  */
   struct buffer *b;

#ifdef WINDOWSNT
   /* Who cares: no buffer can be dumped with a meaningful address.
      We can as well force their values at NULL here. */
   FOR_EACH_BUFFER (b)
   {
     b->text->beg = NULL;
     enlarge_buffer_text (b, 0);
   }
#else
   FOR_EACH_BUFFER (b)
     if (b->text->beg == NULL)
       enlarge_buffer_text (b, 0);
#endif
 }
#endif /* USE_MMAP_FOR_BUFFERS */


and forget about the mmap_set_vars() function?

If this is correct and a change along these lines could be applied, that 
would slightly simplify my patch to come.

Thanks for any comments,

Fabrice




reply via email to

[Prev in Thread] Current Thread [Next in Thread]