- Timestamp:
- Nov 3, 2007, 5:01:18 AM (17 years ago)
- Location:
- trunk/Include
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Include/api_system.sbp
r328 r369 680 680 Declare Function HeapReAlloc Lib "kernel32" (hHeap As HANDLE, dwFlags As DWord, lpMem As VoidPtr, dwBytes As SIZE_T) As VoidPtr 681 681 Declare Function HeapSize Lib "kernel32" (hHeap As HANDLE, dwFlags As DWord, lpMem As VoidPtr) As SIZE_T 682 Declare Function HeapValidate Lib "kernel32" (hHeap As HANDLE, dwFlags As DWord, lpMem As VoidPtr) As BOOL 682 683 Declare Sub InitializeCriticalSection Lib "kernel32" (ByRef CriticalSection As CRITICAL_SECTION) 683 684 Declare Function IsBadReadPtr Lib "kernel32" (lp As VoidPtr, ucb As ULONG_PTR) As BOOL -
trunk/Include/system/gc.sbp
r368 r369 32 32 Class _System_CGarbageCollection 33 33 34 hHeap As HANDLE ' GC用のヒープ 35 34 36 pMemoryObjects As *_System_MemoryObject ' メモリオブジェクト 35 37 countOfMemoryObjects As Long ' 管理するメモリオブジェクトの個数 … … 38 40 39 41 isSweeping As Boolean ' スウィープ中かどうか 42 43 minPtr As ULONG_PTR 44 maxPtr As ULONG_PTR 40 45 41 46 ' クリティカルセクション … … 123 128 ) 124 129 130 hHeap = HeapCreate( 0, 0, 0 ) 131 125 132 pMemoryObjects = _System_calloc( 1 ) 126 133 countOfMemoryObjects=0 … … 135 142 ' スウィープ中かどうか 136 143 isSweeping = False 144 145 minPtr = &HFFFFFFFFFFFFFFFF As ULONG_PTR 146 maxPtr = 0 137 147 138 148 'クリティカルセッションを生成 … … 249 259 pMemoryObjects[countOfMemoryObjects].generationCount = 0 250 260 261 If minPtr > new_ptr As ULONG_PTR Then 262 minPtr = new_ptr As ULONG_PTR 263 End If 264 If maxPtr < ( new_ptr + size ) As ULONG_PTR Then 265 maxPtr = ( new_ptr + size ) As ULONG_PTR 266 End If 267 251 268 countOfMemoryObjects++ 252 269 LeaveCriticalSection(CriticalSection) … … 277 294 278 295 ' 実際のメモリバッファはインデックスの分だけ多めに確保する 279 Dim ptr = HeapAlloc( _System_hProcessHeap, dwFlags, size + SizeOf( LONG_PTR ) ) + SizeOf( LONG_PTR )296 Dim ptr = HeapAlloc( hHeap, dwFlags, size + SizeOf( LONG_PTR ) ) + SizeOf( LONG_PTR ) 280 297 281 298 ' 管理対象のメモリオブジェクトとして追加 … … 302 319 303 320 pTempMemoryObject->size = size 304 pTempMemoryObject->ptr = HeapReAlloc( _System_hProcessHeap, HEAP_ZERO_MEMORY, pTempMemoryObject->ptr - SizeOf(LONG_PTR), size + SizeOf(LONG_PTR) ) + SizeOf(LONG_PTR) 321 pTempMemoryObject->ptr = HeapReAlloc( hHeap, HEAP_ZERO_MEMORY, pTempMemoryObject->ptr - SizeOf(LONG_PTR), size + SizeOf(LONG_PTR) ) + SizeOf(LONG_PTR) 322 323 If minPtr > pTempMemoryObject->ptr As ULONG_PTR Then 324 minPtr = pTempMemoryObject->ptr As ULONG_PTR 325 End If 326 If maxPtr < ( pTempMemoryObject->ptr + size ) As ULONG_PTR Then 327 maxPtr = ( pTempMemoryObject->ptr + size ) As ULONG_PTR 328 End If 305 329 306 330 LeaveCriticalSection(CriticalSection) … … 324 348 iAllSize -= pTempMemoryObject->size 325 349 326 HeapFree( _System_hProcessHeap, 0, pTempMemoryObject->ptr - SizeOf(LONG_PTR) )350 HeapFree( hHeap, 0, pTempMemoryObject->ptr - SizeOf(LONG_PTR) ) 327 351 pTempMemoryObject->ptr = NULL 328 352 pTempMemoryObject->size = 0 … … 387 411 Function HitTest(pSample As VoidPtr) As Long 388 412 If pSample = NULL Then 413 Return -1 414 End If 415 If not( minPtr <= pSample and pSample <= maxPtr ) Then 389 416 Return -1 390 417 End If … … 628 655 629 656 ' マークリストを生成 630 Dim pbMark = HeapAlloc(_System_hProcessHeap,HEAP_ZERO_MEMORY,countOfMemoryObjects*SizeOf(Byte)) As *Byte657 Dim pbMark = _System_calloc(countOfMemoryObjects*SizeOf(Byte)) As *Byte 631 658 632 659 ' グローバル領域をルートに指定してスキャン … … 649 676 650 677 'マークリストを解放 651 HeapFree(_System_hProcessHeap,0,pbMark)678 _System_free(pbMark) 652 679 653 680 If iBackAllSize <= iAllSize * 2 Then
Note:
See TracChangeset
for help on using the changeset viewer.