Index: trunk/Include/system/gc.sbp
===================================================================
--- trunk/Include/system/gc.sbp	(revision 367)
+++ trunk/Include/system/gc.sbp	(revision 368)
@@ -346,9 +346,9 @@
 
 	/*!
-	@brief	スウィープする
-	@author	Daisuke Yamamoto
-	@date	2007/10/21
-	*/
-	Sub sweep()
+	@brief	必要であればスウィープする
+	@author	Daisuke Yamamoto
+	@date	2007/10/21
+	*/
+	Sub TrySweep()
 		If isSweeping <> False or (iAllSize<limitMemorySize and countOfMemoryObjects<limitMemoryObjectNum) Then
 			'メモリ使用量が上限値を超えていないとき
@@ -356,4 +356,13 @@
 		End If
 
+		Sweep()
+	End Sub
+
+	/*!
+	@brief	スウィープする
+	@author	Daisuke Yamamoto
+	@date	2007/10/21
+	*/
+	Sub Sweep()
 		Dim hThread As HANDLE
 		Dim ThreadId As DWord
@@ -377,4 +386,8 @@
 	*/
 	Function HitTest(pSample As VoidPtr) As Long
+		If pSample = NULL Then
+			Return -1
+		End If
+
 		Dim i As Long
 		For i=0 To ELM(countOfMemoryObjects)
@@ -606,7 +619,7 @@
 
 
-		If isSweeping <> False or (iAllSize<limitMemorySize and countOfMemoryObjects<limitMemoryObjectNum) Then
-			ExitThread(0)
-		End If
+		'If isSweeping <> False or (iAllSize<limitMemorySize and countOfMemoryObjects<limitMemoryObjectNum) Then
+		'	ExitThread(0)
+		'End If
 		isSweeping = True
 
@@ -710,5 +723,5 @@
 Function GC_malloc(size As Long) As VoidPtr
 	' sweep
-	_System_pGC->sweep()
+	_System_pGC->TrySweep()
 
 	'allocate
@@ -718,5 +731,5 @@
 Function GC_malloc_atomic(size As Long) As VoidPtr
 	' sweep
-	_System_pGC->sweep()
+	_System_pGC->TrySweep()
 
 	'allocate
@@ -726,5 +739,5 @@
 Function _System_GC_malloc_ForObject(size As Long) As VoidPtr
 	' sweep
-	_System_pGC->sweep()
+	_System_pGC->TrySweep()
 
 	'allocate
@@ -734,5 +747,5 @@
 Function _System_GC_malloc_ForObjectPtr(size As Long) As VoidPtr
 	' sweep
-	_System_pGC->sweep()
+	_System_pGC->TrySweep()
 
 	'allocate
