]> gitweb.factorcode.org Git - factor.git/blobdiff - native/array.c
all-tests now pass without out of memory errors
[factor.git] / native / array.c
index bbf9a4cbdf04e1f2dddc629babdc3c5e77e70de8..231dd54b4b007658dd8a1d1d40cc3e326e44dfe3 100644 (file)
@@ -71,11 +71,11 @@ F_ARRAY* resize_array(F_ARRAY* array, CELL capacity, CELL fill)
 
 void primitive_resize_array(void)
 {
-       F_ARRAY* array; CELL capacity;
-       maybe_gc(0);
+       F_ARRAY* array;
+       CELL capacity = to_fixnum(dpeek2());
+       maybe_gc(array_size(capacity));
        array = untag_array_fast(dpop());
-       capacity = to_fixnum(dpop());
-       dpush(tag_object(resize_array(array,capacity,F)));
+       drepl(tag_object(resize_array(array,capacity,F)));
 }
 
 void fixup_array(F_ARRAY* array)