Пример #1
0
void ST_mmgc_threads::test0() {
       startSlave();
       MMGC_GCENTER(gc);
       RCObjectNotifier *obj = new (gc) RCObjectNotifier(&isDead);
       {
          gc->CreateRootFromCurrentStack(kickAndWait, this);
       }

#line 154 "ST_mmgc_threads.st"
verifyPass(result, "result", __FILE__, __LINE__);

#line 156 "ST_mmgc_threads.st"
verifyPass(!isDead, "!isDead", __FILE__, __LINE__);
       gc->ReapZCT();
#line 158 "ST_mmgc_threads.st"
verifyPass(!isDead, "!isDead", __FILE__, __LINE__);
       gc->Collect();
#line 160 "ST_mmgc_threads.st"
verifyPass(!isDead, "!isDead", __FILE__, __LINE__);

       pthread_join(pthread, NULL);

       printf("Ignore this: %d\n", *obj->isDead);

}
Пример #2
0
	void slaveRun()
	{
		wait();
        {
		 MMGC_GCENTER(gc);	
  	     result &= !isDead;
	     gc->ReapZCT();
  	     result &= !isDead;
	     gc->Collect();
		 result &= !isDead;
		}
 		kick();
	}
Пример #3
0
void ST_mmgc_basics::test3() {
    MMGC_GCENTER(gc);
    MyGCObject *mygcobject;
    int inuse=(int)gc->GetBytesInUse();
    mygcobject = (MyGCObject *)new (gc) MyGCObject();
verifyPass((int)gc->GetBytesInUse()>inuse, "(int)gc->GetBytesInUse()>inuse", __FILE__, __LINE__);
    delete mygcobject;
//    AvmLog("collect: inuse=%d current=%d\n",inuse,(int)gc->GetBytesInUse());
    gc->Collect();      
//    AvmLog("collect: inuse=%d current=%d\n",inuse,(int)gc->GetBytesInUse());
verifyPass((int)gc->GetBytesInUse()<=inuse, "(int)gc->GetBytesInUse()<=inuse", __FILE__, __LINE__);

}
Пример #4
0
void ST_mmgc_basics::test10() {
    MMGC_GCENTER(gc);
	new (gc) DeleteInFinalizer(new (gc, 100) GCFinalizedObject(), new (gc) GCFinalizedObject());
	//delete m;	delete m; // this verifies we crash, it does	
	gc->Collect(false);
verifyPass(true, "true", __FILE__, __LINE__);
    GCFinalizedObject *gcfo = new (gc) GCFinalizedObject();
    gcfo->~GCFinalizedObject();
    gcfo->~GCFinalizedObject(); // this used to be a deleteing dtor and would crash, not anymore
			 

									
									   

}
Пример #5
0
void ST_mmgc_threads::test0() {
	   startSlave();
	   MMGC_GCENTER(gc);
   	   /*RCObject *obj =*/ new (gc) RCObjectNotifier(&isDead);
	   {
          MMGC_GC_ROOT_THREAD(gc);
		  kick();
    	  wait();
       }

verifyPass(result, "result", __FILE__, __LINE__);

verifyPass(!isDead, "!isDead", __FILE__, __LINE__);
	   gc->ReapZCT();
verifyPass(!isDead, "!isDead", __FILE__, __LINE__);
	   gc->Collect();
verifyPass(!isDead, "!isDead", __FILE__, __LINE__);

	   pthread_join(pthread, NULL);

}