File tree Expand file tree Collapse file tree 2 files changed +7
-4
lines changed
Expand file tree Collapse file tree 2 files changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -18,7 +18,11 @@ pub fn determine_garbage(
1818 all_class_instances : & HashSet < Box < dyn ClassInstance > > ,
1919 classes : Vec < Box < dyn ClassInstance > > ,
2020) -> Vec < Box < dyn ClassInstance > > {
21- let mut reachable_objects = classes. into_iter ( ) . collect :: < HashSet < _ > > ( ) ;
21+ let mut reachable_objects = HashSet :: new ( ) ;
22+
23+ classes. into_iter ( ) . for_each ( |x| {
24+ find_reachable_objects ( jvm, & x, & mut reachable_objects) ;
25+ } ) ;
2226
2327 threads
2428 . iter ( )
Original file line number Diff line number Diff line change @@ -26,8 +26,7 @@ async fn test_garbage_collection() -> JvmResult<()> {
2626 let _ = jvm. resolve_class ( "java/util/Random" ) . await ?;
2727 let garbage_count = jvm. collect_garbage ( ) ?;
2828
29- // temporaries used in class loading should be garbage collected
30- assert_eq ! ( garbage_count, 1 ) ;
29+ assert_eq ! ( garbage_count, 0 ) ;
3130
3231 // use loaded class
3332 jvm. push_native_frame ( ) ;
@@ -42,7 +41,7 @@ async fn test_garbage_collection() -> JvmResult<()> {
4241 let garbage_count = jvm. collect_garbage ( ) ?;
4342
4443 // temporaries used in class loading should be garbage collected
45- assert_eq ! ( garbage_count, 9 ) ;
44+ assert_eq ! ( garbage_count, 6 ) ;
4645
4746 // use loaded class
4847 jvm. push_native_frame ( ) ;
You can’t perform that action at this time.
0 commit comments