occ 关键字 new

为何occ 中new 都没有释放?

应该从 foundation class 寻求解答 occ  的内存管理机制

//tobe continued

from  foundation class user guide p13


--------------------------------------------------------------------------------------------------------------------

In Open CASCADE, the Handles are specific classes that are used to safely

manipulate object allocated in the dynamic memory by reference, providing

reference counting mechanism and automatic destruction of the object when it is not 

referenced

与java GC类似

--------------------------------------------------------------------------------------------------------------------


and p22

2.2.3 Using Handles to Create Objects

To create an object which is manipulated by handles, declare the handle and initialize

it with the standard C++ new operator, immediately followed by a call to the 

constructor. The constructor can be any of those specified in the source of the class from 

which the object is instanced.

following is the code 

//Example
Handle (Geom_CartesianPoint) p;
p = new Geom_CartesianPoint(0,0,0);

Handle is not like the pointer, the delete operator does not work on a Handle; the referenced object

is automatically destroyed when no longer in use.


2.3 Memory Management in Open Cascade 

In the course of a work session, geometric modeling applications create and delete a 
considerable number of C++ objects allocated in the dynamic memory( heap). In  this 
context, performance of standard functions for allocating and de-allocating memory
may be not sufficient. For this reason, Open CASCADE  employs a specialized memeory
manager implemented in Standard package.

2.3.1 Usage

Standard::Allocate()
Standard::Free()

你可能感兴趣的:(occ 关键字 new)