For all issues regarding the Forums use, please, refer to the Forum Rules.

Our Solutions

Need professional assistance?
Consider our:

Support Offerings

 

Need to speed up your development?
Have a look at our:

Samples & Tools

 

Need some functionality extending standard OCCT capabilities?
Check out our:

Adv. Components

Related pages

About Handle in function "Geom2dAPI_Interpolate"

Shangjian DU's picture
Forums: 

Hi, dear all,

I am now facing a problem about the Handle which is defined in Open CasCade. e.g., in CAM module I have written an algorithms, in which I tried to approximates a set of U V points in the parametric surface with function “Geom2dAPI_Interpolate”. In the interactive process more thousands approximating BSplines will be generated, At a time generating a BSpline curve “Handle_Geom2d_BSplineCurve”. If the function output the Handle of BSpline to a predefined function and further calculate, it will lost the pre-generated Handle.

Moreover, in the guidebook of CasCade there is so a paragraph about Handle description:
(See the Pdf-Document fcug40.pdf, pp. 25-27)
/////////////
The Handle
Before you delete an object, you must ensure it is no longer referenced. To reduce the programming load resulting from this management of object life, the delete function in Open CASCADE is secured by a reference counter. A smart-pointer called a handle automates reference counter management and automatically deletes an object when it is no longer referenced. You never call the delete operator explicitly on instances of subclasses of Standard_Transient.

Handle has one reference and corresponds to the preceding 48 bytes of memory. In this case, there is no allocation of memory.
//////////////
If the interactive process is performed 10,000 times, it means the system will lost 48*10000/1024 K, that is right?

If there is another strategy to overcome the problem?

By the way, in spit of the above consideration, actually the program is implemented very well.

Thank in advance!

Du