File tree 1 file changed +17
-4
lines changed
1 file changed +17
-4
lines changed Original file line number Diff line number Diff line change @@ -56,6 +56,13 @@ unsafe fn test_triangle() -> bool {
56
56
57
57
ret
58
58
}
59
+ unsafe fn deallocate ( ptr : * mut u8 , size : uint , align : uint ) {
60
+ if PRINT { println ! ( "deallocate(ptr=0x{:010x} size={:u} align={:u})" ,
61
+ ptr as uint, size, align) ;
62
+ }
63
+
64
+ heap:: deallocate ( ptr, size, align) ;
65
+ }
59
66
unsafe fn reallocate ( ptr : * mut u8 , size : uint , align : uint ,
60
67
old_size : uint ) -> * mut u8 {
61
68
if PRINT {
@@ -95,10 +102,16 @@ unsafe fn test_triangle() -> bool {
95
102
}
96
103
97
104
sanity_check ( ascend. as_slice ( ) ) ;
98
- test_1 ( ascend) ;
99
- test_2 ( ascend) ;
100
- test_3 ( ascend) ;
101
- test_4 ( ascend) ;
105
+ test_1 ( ascend) ; // triangle -> square
106
+ test_2 ( ascend) ; // square -> triangle
107
+ test_3 ( ascend) ; // triangle -> square
108
+ test_4 ( ascend) ; // square -> triangle
109
+
110
+ for i in range ( 0 u, COUNT / 2 ) {
111
+ let size = idx_to_size ( i) ;
112
+ deallocate ( ascend[ 2 * i] , size, ALIGN ) ;
113
+ deallocate ( ascend[ 2 * i+1 ] , size, ALIGN ) ;
114
+ }
102
115
103
116
return true ;
104
117
You can’t perform that action at this time.
0 commit comments