Revert "Remove allocate and free"

This reverts commit 1daa8bdb5359c300bc3f6785480e47d9b04f389f.
diff --git a/example/main.dart b/example/main.dart
index b7a2d20..4731e42 100644
--- a/example/main.dart
+++ b/example/main.dart
@@ -1,6 +1,6 @@
 import 'dart:ffi';
 
-import 'package:ffi/ffi.dart';
+import 'package:ffi/ffi.dart' hide allocate;
 
 void main() {
   // Allocate and free some native memory with malloc and free.
diff --git a/lib/ffi.dart b/lib/ffi.dart
index 661a27b..7a8f125 100644
--- a/lib/ffi.dart
+++ b/lib/ffi.dart
@@ -4,4 +4,4 @@
 
 export 'src/utf8.dart';
 export 'src/utf16.dart';
-export 'src/allocation.dart' show calloc, malloc;
+export 'src/allocation.dart' show allocate, free, calloc, malloc;
diff --git a/lib/src/allocation.dart b/lib/src/allocation.dart
index 371dc5e..c474119 100644
--- a/lib/src/allocation.dart
+++ b/lib/src/allocation.dart
@@ -43,6 +43,32 @@
 
 const int HEAP_ZERO_MEMORY = 8;
 
+/// Allocates memory on the native heap.
+///
+/// For POSIX-based systems, this uses calloc. On Windows, it uses HeapAlloc
+/// against the default public heap. Allocation of either element size or count
+/// of 0 is undefined.
+///
+/// Throws an ArgumentError on failure to allocate.
+@Deprecated('Use calloc.allocate instead.')
+Pointer<T> allocate<T extends NativeType>({int count = 1}) {
+  final int totalSize = count * sizeOf<T>();
+  return calloc.allocate(totalSize);
+}
+
+/// Releases memory on the native heap.
+///
+/// For POSIX-based systems, this uses free. On Windows, it uses HeapFree
+/// against the default public heap. It may only be used against pointers
+/// allocated in a manner equivalent to [allocate].
+///
+/// Throws an ArgumentError on failure to free.
+///
+// TODO(dartbug.com/36855): Once we have a ffi.Bool type we can use it instead
+// of testing the return integer to be non-zero.
+@Deprecated('Use calloc.free instead.')
+void free(Pointer pointer) => calloc.free(pointer);
+
 /// Manages memory on the native heap.
 ///
 /// Does not intialize newly allocated memory to zero. Use [_CallocAllocator]