diff --git a/CHANGELOG.md b/CHANGELOG.md
index aaf125a..b36f9a9 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
 The format is based on [Keep a Changelog](http://keepachangelog.com/)
 and this project adheres to [Semantic Versioning](http://semver.org/).
 
+## [2.4.9] - (Unreleased)
+
+### Changed
+
+- `MemFS` now immediately releases all memory it holds when `close()` is called,
+  rather than when it gets garbage collected. Closes [issue #308](https://github.com/PyFilesystem/pyfilesystem2/issues/308).
+
 ## [2.4.8] - 2019-06-12
 
 ### Changed
diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md
index 5c2a9b5..ef1d3a0 100644
--- a/CONTRIBUTORS.md
+++ b/CONTRIBUTORS.md
@@ -2,6 +2,7 @@
 
 Many thanks to the following developers for contributing to this project:
 
+- [Diego Argueta](https://github.com/dargueta)
 - [Geoff Jukes](https://github.com/geoffjukes)
 - [Giampaolo](https://github.com/gpcimino)
 - [Martin Larralde](https://github.com/althonos)
diff --git a/fs/base.py b/fs/base.py
index 25f6db4..9e1f858 100644
--- a/fs/base.py
+++ b/fs/base.py
@@ -101,6 +101,9 @@ class FS(object):
     # most FS will use default walking algorithms
     walker_class = Walker
 
+    # default to SubFS, used by opendir and should be returned by makedir(s)
+    subfs_class = None
+
     def __init__(self):
         # type: (...) -> None
         """Create a filesystem. See help(type(self)) for accurate signature.
@@ -1180,7 +1183,7 @@ class FS(object):
             factory (callable, optional): A callable that when invoked
                 with an FS instance and ``path`` will return a new FS object
                 representing the sub-directory contents. If no ``factory``
-                is supplied then `~fs.subfs.SubFS` will be used.
+                is supplied then `~fs.subfs_class` will be used.
 
         Returns:
             ~fs.subfs.SubFS: A filesystem representing a sub-directory.
@@ -1192,7 +1195,7 @@ class FS(object):
         """
         from .subfs import SubFS
 
-        _factory = factory or SubFS
+        _factory = factory or self.subfs_class or SubFS
 
         if not self.getbasic(path).is_dir:
             raise errors.DirectoryExpected(path=path)
diff --git a/fs/memoryfs.py b/fs/memoryfs.py
index 2446b0d..dcee49d 100644
--- a/fs/memoryfs.py
+++ b/fs/memoryfs.py
@@ -340,6 +340,11 @@ class MemoryFS(FS):
                 current_entry = current_entry.get_entry(path_component)
             return current_entry
 
+    def close(self):
+        # type: () -> None
+        self.root = None
+        return super(MemoryFS, self).close()
+
     def getinfo(self, path, namespaces=None):
         # type: (Text, Optional[Collection[Text]]) -> Info
         namespaces = namespaces or ()

diff --git a/tests/test_memoryfs.py b/tests/test_memoryfs.py
index 8f8adbd..aaf6e77 100644
--- a/tests/test_memoryfs.py
+++ b/tests/test_memoryfs.py
@@ -1,9 +1,17 @@
 from __future__ import unicode_literals
 
+import posixpath
 import unittest
 
 from fs import memoryfs
 from fs.test import FSTestCases
+from fs.test import UNICODE_TEXT
+
+try:
+    # Only supported on Python 3.4+
+    import tracemalloc
+except ImportError:
+    tracemalloc = None
 
 
 class TestMemoryFS(FSTestCases, unittest.TestCase):
@@ -11,3 +19,50 @@ class TestMemoryFS(FSTestCases, unittest.TestCase):
 
     def make_fs(self):
         return memoryfs.MemoryFS()
+
+    def _create_many_files(self):
+        for parent_dir in {"/", "/one", "/one/two", "/one/other-two/three"}:
+            self.fs.makedirs(parent_dir, recreate=True)
+            for file_id in range(50):
+                self.fs.writetext(
+                    posixpath.join(parent_dir, str(file_id)), UNICODE_TEXT
+                )
+
+    @unittest.skipIf(
+        not tracemalloc, "`tracemalloc` isn't supported on this Python version."
+    )
+    def test_close_mem_free(self):
+        """Ensure all file memory is freed when calling close().
+
+        Prevents regression against issue #308.
+        """
+        trace_filters = [tracemalloc.Filter(True, "*/memoryfs.py")]
+        tracemalloc.start()
+
+        before = tracemalloc.take_snapshot().filter_traces(trace_filters)
+        self._create_many_files()
+        after_create = tracemalloc.take_snapshot().filter_traces(trace_filters)
+
+        self.fs.close()
+        after_close = tracemalloc.take_snapshot().filter_traces(trace_filters)
+        tracemalloc.stop()
+
+        [diff_create] = after_create.compare_to(
+            before, key_type="filename", cumulative=True
+        )
+        self.assertGreater(
+            diff_create.size_diff,
+            0,
+            "Memory usage didn't increase after creating files; diff is %0.2f KiB."
+            % (diff_create.size_diff / 1024.0),
+        )
+
+        [diff_close] = after_close.compare_to(
+            after_create, key_type="filename", cumulative=True
+        )
+        self.assertLess(
+            diff_close.size_diff,
+            0,
+            "Memory usage increased after closing the file system; diff is %0.2f KiB."
+            % (diff_close.size_diff / 1024.0),
+        )
diff --git a/tests/test_subfs.py b/tests/test_subfs.py
index 633048f..c360431 100644
--- a/tests/test_subfs.py
+++ b/tests/test_subfs.py
@@ -3,8 +3,11 @@ from __future__ import unicode_literals
 import os
 import shutil
 import tempfile
+import unittest
 
 from fs import osfs
+from fs.subfs import SubFS
+from fs.memoryfs import MemoryFS
 from fs.path import relpath
 from .test_osfs import TestOSFS
 
@@ -26,3 +29,44 @@ class TestSubFS(TestOSFS):
     def _get_real_path(self, path):
         _path = os.path.join(self.temp_dir, "__subdir__", relpath(path))
         return _path
+
+
+class CustomSubFS(SubFS):
+    """Just a custom class to change the type"""
+
+    def custom_function(self, custom_path):
+        fs, delegate_path = self.delegate_path(custom_path)
+        fs.custom_function(delegate_path)
+
+
+class CustomSubFS2(SubFS):
+    """Just a custom class to change the type"""
+
+
+class CustomFS(MemoryFS):
+    subfs_class = CustomSubFS
+
+    def __init__(self):
+        super(CustomFS, self).__init__()
+        self.custom_path = None
+
+    def custom_function(self, custom_path):
+        self.custom_path = custom_path
+
+
+class TestCustomSubFS(unittest.TestCase):
+    """Test customization of the SubFS returned from opendir etc"""
+
+    def test_opendir(self):
+        fs = CustomFS()
+        fs.makedir("__subdir__")
+        subfs = fs.opendir("__subdir__")
+        # By default, you get the fs's defined custom SubFS
+        assert isinstance(subfs, CustomSubFS)
+
+        subfs.custom_function("filename")
+        assert fs.custom_path == "/__subdir__/filename"
+
+        # Providing the factory explicitly still works
+        subfs = fs.opendir("__subdir__", factory=CustomSubFS2)
+        assert isinstance(subfs, CustomSubFS2)

Expose SubFS factory
There are some custom methods (i.e. not overrides) on GoogleFS and OneDriveFS to expose specific features of those filesystems.

My problem is that makedir(s) returns a SubFS which then doesn't support those custom methods so you can't use it transparently (e.g. in the tests)
I see that opendir has a factory parameter so that you can customize the return type, but that's missing from the other SubFS-returning functions.
I'd suggest that we could add the same factory parameter to makedir(s), except that it seems to me that it shouldn't be specified by the user but by the filesystem developer - maybe in the _meta dictionary?
I suppose that another way to do it would be to use the custom factory if the user specifies one but if factory is None, use the GoogleFS-specified one.

What do you think?
tests/test_subfs.py::TestCustomSubFS::test_opendir
tests/test_subfs.py::TestOSFS::test_appendbytes tests/test_subfs.py::TestOSFS::test_unicode_paths tests/test_subfs.py::TestOSFS::test_root_dir tests/test_subfs.py::TestOSFS::test_openbin_rw tests/test_subfs.py::TestOSFS::test_openbin_exclusive tests/test_subfs.py::TestOSFS::test_copydir tests/test_subfs.py::TestOSFS::test_download_4 tests/test_subfs.py::TestOSFS::test_geturl tests/test_subfs.py::TestOSFS::test_openbin tests/test_subfs.py::TestOSFS::test_symlinks tests/test_subfs.py::TestOSFS::test_setinfo tests/test_subfs.py::TestOSFS::test_getsyspath tests/test_subfs.py::TestOSFS::test_match tests/test_subfs.py::TestOSFS::test_getinfo tests/test_subfs.py::TestOSFS::test_invalid_chars tests/test_subfs.py::TestOSFS::test_basic tests/test_subfs.py::TestOSFS::test_not_exists tests/test_subfs.py::TestOSFS::test_readbytes tests/test_subfs.py::TestOSFS::test_isfile tests/test_subfs.py::TestOSFS::test_isempty tests/test_subfs.py::TestOSFS::test_writebytes tests/test_subfs.py::TestOSFS::test_appendtext tests/test_subfs.py::TestOSFS::test_listdir tests/test_subfs.py::TestOSFS::test_writefile tests/test_subfs.py::TestOSFS::test_move_dir_mem tests/test_subfs.py::TestOSFS::test_move_file_temp tests/test_subfs.py::TestOSFS::test_upload_chunk_size tests/test_subfs.py::TestOSFS::test_exists tests/test_subfs.py::TestOSFS::test_opendir tests/test_subfs.py::TestOSFS::test_tree tests/test_subfs.py::TestOSFS::test_upload_4 tests/test_subfs.py::TestOSFS::test_validatepath tests/test_subfs.py::TestOSFS::test_readtext tests/test_subfs.py::TestOSFS::test_upload_2 tests/test_subfs.py::TestOSFS::test_copy_dir_mem tests/test_subfs.py::TestOSFS::test_isdir tests/test_subfs.py::TestOSFS::test_removetree tests/test_subfs.py::TestOSFS::test_filterdir tests/test_subfs.py::TestOSFS::test_copy_file tests/test_subfs.py::TestOSFS::test_move_same_fs tests/test_subfs.py::TestOSFS::test_upload tests/test_subfs.py::TestOSFS::test_geturl_purpose tests/test_subfs.py::TestOSFS::test_movedir tests/test_subfs.py::TestOSFS::test_copy tests/test_subfs.py::TestOSFS::test_settimes tests/test_subfs.py::TestOSFS::test_makedirs tests/test_subfs.py::TestOSFS::test_open tests/test_subfs.py::TestOSFS::test_download tests/test_subfs.py::TestOSFS::test_removedir tests/test_subfs.py::TestOSFS::test_hash tests/test_subfs.py::TestOSFS::test_copy_structure tests/test_subfs.py::TestOSFS::test_files tests/test_subfs.py::TestOSFS::test_remove tests/test_subfs.py::TestOSFS::test_open_files tests/test_subfs.py::TestOSFS::test_move_dir_temp tests/test_subfs.py::TestOSFS::test_close tests/test_subfs.py::TestOSFS::test_getsize tests/test_subfs.py::TestOSFS::test_download_2 tests/test_subfs.py::TestOSFS::test_open_exclusive tests/test_subfs.py::TestOSFS::test_desc tests/test_subfs.py::TestOSFS::test_upload_0 tests/test_subfs.py::TestOSFS::test_move_file_mem tests/test_subfs.py::TestOSFS::test_glob tests/test_subfs.py::TestOSFS::test_writetext tests/test_subfs.py::TestOSFS::test_expand_vars tests/test_subfs.py::TestOSFS::test_repeat_dir tests/test_subfs.py::TestOSFS::test_touch tests/test_subfs.py::TestOSFS::test_copy_dir_temp tests/test_subfs.py::TestOSFS::test_islink tests/test_subfs.py::TestOSFS::test_scandir tests/test_subfs.py::TestOSFS::test_upload_1 tests/test_subfs.py::TestOSFS::test_create tests/test_subfs.py::TestOSFS::test_download_0 tests/test_subfs.py::TestOSFS::test_getmeta tests/test_subfs.py::TestOSFS::test_bin_files tests/test_subfs.py::TestOSFS::test_makedir tests/test_subfs.py::TestOSFS::test_move tests/test_subfs.py::TestOSFS::test_download_chunk_size tests/test_subfs.py::TestOSFS::test_move_file_same_fs tests/test_subfs.py::TestOSFS::test_case_sensitive tests/test_subfs.py::TestOSFS::test_download_1 tests/test_subfs.py::TestSubFS::test_copydir tests/test_subfs.py::TestSubFS::test_move_same_fs tests/test_subfs.py::TestSubFS::test_writebytes tests/test_subfs.py::TestSubFS::test_getmeta tests/test_subfs.py::TestSubFS::test_scandir tests/test_subfs.py::TestSubFS::test_makedirs tests/test_subfs.py::TestSubFS::test_openbin_exclusive tests/test_subfs.py::TestSubFS::test_match tests/test_subfs.py::TestSubFS::test_move_dir_temp tests/test_subfs.py::TestSubFS::test_appendtext tests/test_subfs.py::TestSubFS::test_desc tests/test_subfs.py::TestSubFS::test_download_2 tests/test_subfs.py::TestSubFS::test_root_dir tests/test_subfs.py::TestSubFS::test_exists tests/test_subfs.py::TestSubFS::test_move_file_temp tests/test_subfs.py::TestSubFS::test_geturl tests/test_subfs.py::TestSubFS::test_copy_dir_mem tests/test_subfs.py::TestSubFS::test_isdir tests/test_subfs.py::TestSubFS::test_removetree tests/test_subfs.py::TestSubFS::test_files tests/test_subfs.py::TestSubFS::test_move tests/test_subfs.py::TestSubFS::test_filterdir tests/test_subfs.py::TestSubFS::test_download_4 tests/test_subfs.py::TestSubFS::test_validatepath tests/test_subfs.py::TestSubFS::test_movedir tests/test_subfs.py::TestSubFS::test_isfile tests/test_subfs.py::TestSubFS::test_readbytes tests/test_subfs.py::TestSubFS::test_bin_files tests/test_subfs.py::TestSubFS::test_writefile tests/test_subfs.py::TestSubFS::test_open tests/test_subfs.py::TestSubFS::test_move_file_same_fs tests/test_subfs.py::TestSubFS::test_openbin_rw tests/test_subfs.py::TestSubFS::test_basic tests/test_subfs.py::TestSubFS::test_readtext tests/test_subfs.py::TestSubFS::test_copy tests/test_subfs.py::TestSubFS::test_upload_2 tests/test_subfs.py::TestSubFS::test_unicode_paths tests/test_subfs.py::TestSubFS::test_listdir tests/test_subfs.py::TestSubFS::test_not_exists tests/test_subfs.py::TestSubFS::test_remove tests/test_subfs.py::TestSubFS::test_geturl_purpose tests/test_subfs.py::TestSubFS::test_tree tests/test_subfs.py::TestSubFS::test_download tests/test_subfs.py::TestSubFS::test_copy_structure tests/test_subfs.py::TestSubFS::test_upload_0 tests/test_subfs.py::TestSubFS::test_removedir tests/test_subfs.py::TestSubFS::test_getsize tests/test_subfs.py::TestSubFS::test_repeat_dir tests/test_subfs.py::TestSubFS::test_upload_chunk_size tests/test_subfs.py::TestSubFS::test_appendbytes tests/test_subfs.py::TestSubFS::test_touch tests/test_subfs.py::TestSubFS::test_copy_file tests/test_subfs.py::TestSubFS::test_case_sensitive tests/test_subfs.py::TestSubFS::test_download_chunk_size tests/test_subfs.py::TestSubFS::test_move_dir_mem tests/test_subfs.py::TestSubFS::test_symlinks tests/test_subfs.py::TestSubFS::test_open_exclusive tests/test_subfs.py::TestSubFS::test_move_file_mem tests/test_subfs.py::TestSubFS::test_upload_4 tests/test_subfs.py::TestSubFS::test_makedir tests/test_subfs.py::TestSubFS::test_create tests/test_subfs.py::TestSubFS::test_open_files tests/test_subfs.py::TestSubFS::test_download_1 tests/test_subfs.py::TestSubFS::test_download_0 tests/test_subfs.py::TestSubFS::test_settimes tests/test_subfs.py::TestSubFS::test_setinfo tests/test_subfs.py::TestSubFS::test_upload tests/test_subfs.py::TestSubFS::test_upload_1 tests/test_subfs.py::TestSubFS::test_openbin tests/test_subfs.py::TestSubFS::test_close tests/test_subfs.py::TestSubFS::test_getinfo tests/test_subfs.py::TestSubFS::test_isempty tests/test_subfs.py::TestSubFS::test_writetext tests/test_subfs.py::TestSubFS::test_hash tests/test_subfs.py::TestSubFS::test_getsyspath tests/test_subfs.py::TestSubFS::test_expand_vars tests/test_subfs.py::TestSubFS::test_invalid_chars tests/test_subfs.py::TestSubFS::test_copy_dir_temp tests/test_subfs.py::TestSubFS::test_glob tests/test_subfs.py::TestSubFS::test_opendir tests/test_subfs.py::TestSubFS::test_islink tests/test_memoryfs.py::TestMemoryFS::test_movedir tests/test_memoryfs.py::TestMemoryFS::test_openbin tests/test_memoryfs.py::TestMemoryFS::test_open tests/test_memoryfs.py::TestMemoryFS::test_create tests/test_memoryfs.py::TestMemoryFS::test_validatepath tests/test_memoryfs.py::TestMemoryFS::test_unicode_path tests/test_memoryfs.py::TestMemoryFS::test_upload_2 tests/test_memoryfs.py::TestMemoryFS::test_download_chunk_size tests/test_memoryfs.py::TestMemoryFS::test_getsyspath tests/test_memoryfs.py::TestMemoryFS::test_writefile tests/test_memoryfs.py::TestMemoryFS::test_desc tests/test_memoryfs.py::TestMemoryFS::test_settimes tests/test_memoryfs.py::TestMemoryFS::test_upload_4 tests/test_memoryfs.py::TestMemoryFS::test_move_dir_temp tests/test_memoryfs.py::TestMemoryFS::test_open_files tests/test_memoryfs.py::TestMemoryFS::test_root_dir tests/test_memoryfs.py::TestMemoryFS::test_upload_chunk_size tests/test_memoryfs.py::TestMemoryFS::test_setinfo tests/test_memoryfs.py::TestMemoryFS::test_copy_file tests/test_memoryfs.py::TestMemoryFS::test_readtext tests/test_memoryfs.py::TestMemoryFS::test_appendbytes tests/test_memoryfs.py::TestMemoryFS::test_download tests/test_memoryfs.py::TestMemoryFS::test_move_same_fs tests/test_memoryfs.py::TestMemoryFS::test_tree tests/test_memoryfs.py::TestMemoryFS::test_openbin_exclusive tests/test_memoryfs.py::TestMemoryFS::test_files tests/test_memoryfs.py::TestMemoryFS::test_move_file_temp tests/test_memoryfs.py::TestMemoryFS::test_copydir tests/test_memoryfs.py::TestMemoryFS::test_makedir tests/test_memoryfs.py::TestMemoryFS::test_makedirs tests/test_memoryfs.py::TestMemoryFS::test_basic tests/test_memoryfs.py::TestMemoryFS::test_move_dir_mem tests/test_memoryfs.py::TestMemoryFS::test_listdir tests/test_memoryfs.py::TestMemoryFS::test_upload tests/test_memoryfs.py::TestMemoryFS::test_match tests/test_memoryfs.py::TestMemoryFS::test_download_2 tests/test_memoryfs.py::TestMemoryFS::test_geturl tests/test_memoryfs.py::TestMemoryFS::test_download_4 tests/test_memoryfs.py::TestMemoryFS::test_download_0 tests/test_memoryfs.py::TestMemoryFS::test_move tests/test_memoryfs.py::TestMemoryFS::test_remove tests/test_memoryfs.py::TestMemoryFS::test_scandir tests/test_memoryfs.py::TestMemoryFS::test_filterdir tests/test_memoryfs.py::TestMemoryFS::test_exists tests/test_memoryfs.py::TestMemoryFS::test_copy_structure tests/test_memoryfs.py::TestMemoryFS::test_removetree tests/test_memoryfs.py::TestMemoryFS::test_copy_dir_temp tests/test_memoryfs.py::TestMemoryFS::test_appendtext tests/test_memoryfs.py::TestMemoryFS::test_removedir tests/test_memoryfs.py::TestMemoryFS::test_getsize tests/test_memoryfs.py::TestMemoryFS::test_getmeta tests/test_memoryfs.py::TestMemoryFS::test_isfile tests/test_memoryfs.py::TestMemoryFS::test_glob tests/test_memoryfs.py::TestMemoryFS::test_bin_files tests/test_memoryfs.py::TestMemoryFS::test_readbytes tests/test_memoryfs.py::TestMemoryFS::test_touch tests/test_memoryfs.py::TestMemoryFS::test_close_mem_free tests/test_memoryfs.py::TestMemoryFS::test_isempty tests/test_memoryfs.py::TestMemoryFS::test_case_sensitive tests/test_memoryfs.py::TestMemoryFS::test_move_file_mem tests/test_memoryfs.py::TestMemoryFS::test_islink tests/test_memoryfs.py::TestMemoryFS::test_opendir tests/test_memoryfs.py::TestMemoryFS::test_hash tests/test_memoryfs.py::TestMemoryFS::test_close tests/test_memoryfs.py::TestMemoryFS::test_getinfo tests/test_memoryfs.py::TestMemoryFS::test_openbin_rw tests/test_memoryfs.py::TestMemoryFS::test_copy tests/test_memoryfs.py::TestMemoryFS::test_download_1 tests/test_memoryfs.py::TestMemoryFS::test_repeat_dir tests/test_memoryfs.py::TestMemoryFS::test_open_exclusive tests/test_memoryfs.py::TestMemoryFS::test_writetext tests/test_memoryfs.py::TestMemoryFS::test_move_file_same_fs tests/test_memoryfs.py::TestMemoryFS::test_upload_0 tests/test_memoryfs.py::TestMemoryFS::test_copy_dir_mem tests/test_memoryfs.py::TestMemoryFS::test_upload_1 tests/test_memoryfs.py::TestMemoryFS::test_isdir tests/test_memoryfs.py::TestMemoryFS::test_writebytes tests/test_memoryfs.py::TestMemoryFS::test_geturl_purpose tests/test_memoryfs.py::TestMemoryFS::test_invalid_chars