emacs-devel
[Top][All Lists]
Advanced

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

Re: How to add pseudo vector types


From: Eli Zaretskii
Subject: Re: How to add pseudo vector types
Date: Sat, 24 Jul 2021 09:00:56 +0300

> From: Yuan Fu <casouri@gmail.com>
> Date: Fri, 23 Jul 2021 16:22:59 -0400
> Cc: Stefan Monnier <monnier@iro.umontreal.ca>,
>  Clément Pit-Claudel <cpitclaudel@gmail.com>,
>  emacs-devel@gnu.org
> 
> > We must replace this function, if only because the MS-Windows build of
> > Emacs uses a custom malloc implementation.  Does TS allow the client
> > to use its own malloc?
> 
> Yes, in that case, we need to embed tree-sitter into Emacs, instead of using 
> it as a dynamic library, I think.
> 
> // Allow clients to override allocation functions
> #ifndef ts_malloc
> #define ts_malloc  ts_malloc_default
> #endif
> #ifndef ts_calloc
> #define ts_calloc  ts_calloc_default
> #endif
> #ifndef ts_realloc
> #define ts_realloc ts_realloc_default
> #endif
> #ifndef ts_free
> #define ts_free    ts_free_default
> #endif
> 
> How do we handle such thing in Emacs?

We use xmalloc, which calls memory_full when allocation fails, which
releases some spare memory we have for this purpose, and tells the
user to save the session and exit.



reply via email to

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