Do not free the input / output buffers to avoid consing and memory fragmentation... ECL_9_12_2
authorJuan Jose Garcia Ripoll <jjgarcia@juanjo-imac.local>
Wed, 2 Dec 2009 15:02:58 +0000 (16:02 +0100)
committerJuan Jose Garcia Ripoll <jjgarcia@juanjo-imac.local>
Wed, 2 Dec 2009 15:02:58 +0000 (16:02 +0100)
src/c/alloc_2.d
src/c/read.d

index df51232..1f9a49f 100644 (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 */
index e239853..cbe80ad 100644 (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);
                }