mirror of
https://gitlab.com/embeddable-common-lisp/ecl.git
synced 2026-01-15 05:43:19 -08:00
Do not free the input / output buffers to avoid consing and memory fragmentation when reading long strings.
This commit is contained in:
parent
bbd35c1a6f
commit
5338bcb157
2 changed files with 8 additions and 0 deletions
|
|
@ -70,6 +70,8 @@ out_of_memory(size_t requested_bytes)
|
|||
int method = 0;
|
||||
if (!interrupts)
|
||||
ecl_disable_interrupts_env(the_env);
|
||||
/* Free the input / output buffers */
|
||||
the_env->string_pool = Cnil;
|
||||
#ifdef ECL_THREADS
|
||||
/* The out of memory condition may happen in more than one thread */
|
||||
/* But then we have to ensure the error has not been solved */
|
||||
|
|
|
|||
|
|
@ -82,6 +82,11 @@ si_put_buffer_string(cl_object string)
|
|||
l = TOKEN_STRING_FILLP(ECL_CONS_CAR(pool));
|
||||
}
|
||||
if (l < ECL_MAX_STRING_POOL_SIZE) {
|
||||
/* Ok, by ignoring the following code, here we
|
||||
* are doing like SBCL: we simply grow the
|
||||
* input buffer and do not care about its
|
||||
* size. */
|
||||
#if 0
|
||||
if (TOKEN_STRING_DIM(string) > 32*ECL_BUFFER_STRING_SIZE) {
|
||||
/* String has been enlarged. Cut it. */
|
||||
#ifdef ECL_UNICODE
|
||||
|
|
@ -90,6 +95,7 @@ si_put_buffer_string(cl_object string)
|
|||
string = ecl_alloc_adjustable_base_string(ECL_BUFFER_STRING_SIZE);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
TOKEN_STRING_FILLP(string) = l+1;
|
||||
env->string_pool = CONS(string, pool);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue