diff --git a/extra/cocoa/enumeration/enumeration.factor b/extra/cocoa/enumeration/enumeration.factor
index ae1766b1a9..0cd8e90531 100644
--- a/extra/cocoa/enumeration/enumeration.factor
+++ b/extra/cocoa/enumeration/enumeration.factor
@@ -1,28 +1,30 @@
 USING: kernel cocoa cocoa.types alien.c-types locals math sequences
-vectors fry ;
+vectors fry libc ;
 IN: cocoa.enumeration
 
 : NS-EACH-BUFFER-SIZE 16 ; inline
 
-: (allocate-enumeration-buffers) ( -- state stackbuf count )
-    "NSFastEnumerationState" <c-object>
-    NS-EACH-BUFFER-SIZE "id" <c-array>
-    NS-EACH-BUFFER-SIZE ;
+: (with-enumeration-buffers) ( quot -- )
+    "NSFastEnumerationState" heap-size swap '[
+        NS-EACH-BUFFER-SIZE "id" heap-size * [
+            NS-EACH-BUFFER-SIZE @
+        ] with-malloc
+    ] with-malloc ; inline
 
 :: (NSFastEnumeration-each) ( object quot state stackbuf count -- )
     object state stackbuf count -> countByEnumeratingWithState:objects:count:
     dup zero? [ drop ] [
-        [
-            state NSFastEnumerationState-itemsPtr dup stackbuf ?
-            void*-nth quot call
-        ] each object quot state stackbuf count (NSFastEnumeration-each)
+        state NSFastEnumerationState-itemsPtr [ stackbuf ] unless*
+        '[ , void*-nth quot call ] each
+        object quot state stackbuf count (NSFastEnumeration-each)
     ] if ; inline
 
 : NSFastEnumeration-each ( object quot -- )
-    (allocate-enumeration-buffers) (NSFastEnumeration-each) ; inline
+    [ (NSFastEnumeration-each) ] (with-enumeration-buffers) ; inline
 
 : NSFastEnumeration-map ( object quot -- vector )
-    NS-EACH-BUFFER-SIZE <vector> [ '[ @ , push ] NSFastEnumeration-each ] keep ; inline
+    NS-EACH-BUFFER-SIZE <vector>
+    [ '[ @ , push ] NSFastEnumeration-each ] keep ; inline
 
 : NSFastEnumeration>vector ( object -- vector )
     [ ] NSFastEnumeration-map ;