You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: src/memory_manager.rs
+3-40
Original file line number
Diff line number
Diff line change
@@ -35,9 +35,8 @@ use std::sync::atomic::Ordering;
35
35
/// 2. Set command line options for MMTKBuilder by [`crate::memory_manager::process`] or [`crate::memory_manager::process_bulk`].
36
36
/// 3. Initialize MMTk by calling this function, `mmtk_init()`, and pass the builder earlier. This call will return an MMTK instance.
37
37
/// Usually a binding store the MMTK instance statically as a singleton. We plan to allow multiple instances, but this is not yet fully
38
-
/// supported. Currently we assume a binding will only need one MMTk instance.
39
-
/// 4. Enable garbage collection in MMTk by [`crate::memory_manager::enable_collection`]. A binding should only call this once its
40
-
/// thread system is ready. MMTk will not trigger garbage collection before this call.
38
+
/// supported. Currently we assume a binding will only need one MMTk instance. Note that GC is enabled by default and the binding should
39
+
/// implement `VMCollection::is_collection_enabled()` if it requires that the GC should be disabled at a particular time.
41
40
///
42
41
/// Note that this method will attempt to initialize a logger. If the VM would like to use its own logger, it should initialize the logger before calling this method.
43
42
/// Note that, to allow MMTk to do GC properly, `initialize_collection()` needs to be called after this call when
Copy file name to clipboardexpand all lines: src/vm/tests/mock_tests/mock_test_allocate_with_re_enable_collection.rs
+15-16
Original file line number
Diff line number
Diff line change
@@ -4,8 +4,9 @@ use crate::util::test_util::mock_method::*;
4
4
usecrate::util::test_util::mock_vm::*;
5
5
usecrate::AllocationSemantics;
6
6
7
-
// This test allocates after calling initialize_collection(). When we exceed the heap limit, MMTk will trigger a GC. And block_for_gc will be called.
8
-
// We havent implemented block_for_gc so it will panic. This test is similar to allocate_with_initialize_collection, except that we once disabled GC in the test.
7
+
/// This test allocates after calling `initialize_collection()`. When we exceed the heap limit for the first time, MMTk will not trigger GC since GC has been disabled
8
+
/// However, the second 1MB allocation will trigger a GC since GC is enabled again. And `block_for_gc` will be called.
9
+
/// We haven't implemented `block_for_gc` so it will panic. This test is similar to `allocate_with_initialize_collection`, except that GC is disabled once in the test.
9
10
#[test]
10
11
#[should_panic(expected = "block_for_gc is called")]
0 commit comments