[Top][All Lists]

[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() 
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:

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

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

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

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,


reply via email to

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