Revision bf76b38a16a1c7c2b9b54c40b3d6e1471fe79c7b authored by Giuseppe Attardi on 02 November 1995, 15:11:11 UTC, committed by CMM Curation Team on 11 December 2019, 14:35:48 UTC
Contributors mentioned in Changelog : - Giuseppe Attardi @attardi - Tito Flagella @tflagella - Pietro Iglio
1 parent b9c41e1
test6.cc
#include "heapstack.h"
#include <iostream.h>
class MyClass : public CmmObject
{
int x;
MyClass *y;
public:
void test() { cout << "Testing ... Ok\n" ; }
void traverse() { Cmm::heap->scavenge((CmmObject **)&y); }
};
main()
{
MyClass *MyVar;
CmmHeap *MyHeap = new BBStack(100000);
GcArray<MyClass> * MyVector = new (100, Cmm::heap) GcArray<MyClass> ;
// Instead of
// .... MyVar = new MyClass[100];
// Use ....
MyVar = (MyClass *) new (sizeof(MyClass) * 100, MyHeap) CmmVarObject ;
MyVar[2].test();
Cmm::heap->collect();
MyVar[2].test();
}
Computing file changes ...