unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Question about mmap buffers
@ 2014-04-25 11:20 Fabrice Popineau
  2014-04-29 16:24 ` Fabrice Popineau
  0 siblings, 1 reply; 4+ messages in thread
From: Fabrice Popineau @ 2014-04-25 11:20 UTC (permalink / raw)
  To: emacs-devel


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




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

end of thread, other threads:[~2014-05-17  7:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-25 11:20 Question about mmap buffers Fabrice Popineau
2014-04-29 16:24 ` Fabrice Popineau
2014-05-14 18:06   ` Eli Zaretskii
2014-05-17  7:16     ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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).