Skip to content

Instantly share code, notes, and snippets.

@itfrombit
Created December 5, 2008 01:52
Show Gist options
  • Save itfrombit/32200 to your computer and use it in GitHub Desktop.
Save itfrombit/32200 to your computer and use it in GitHub Desktop.
(set malloc (NuBridgedFunction functionWithName:"malloc" signature:"li"))
(set memset (NuBridgedFunction functionWithName:"memset" signature:"llil"))
(set getchar (NuBridgedFunction functionWithName:"getchar" signature:"i"))
;; Allocate in 100MB chunks...
(set bytecount (* 1024 1024 100))
(set iterations 10)
(set i 0)
(while (< i iterations)
(set ptr (malloc bytecount))
(memset ptr 1 bytecount)
(puts "Allocating #{bytecount} bytes: #{ptr}")
(set i (+ i 1)))
(getchar)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment