Do not free the input / output buffers to avoid consing and memory fragmentation when reading long strings.

This commit is contained in:
Juan Jose Garcia Ripoll 2009-12-02 16:02:58 +01:00
parent bbd35c1a6f
commit 5338bcb157
2 changed files with 8 additions and 0 deletions

View file

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

View file

@ -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);
}