Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

VBA/CATScript memory leak

Status
Not open for further replies.

peter_m

Automotive
Sep 16, 2016
4
NL
Hello Everyone

I have read that memory leak when running scripts in Catia is a "feature", but until now I didn't realize that it leaks like a sieve. Or maybe I'm doing something wrong.

I wrote a simple script to test this:

Code:
Sub CATMain()
	Dim oDocument As PartDocument
	Dim oPoint As HybridShapePointCoord
    
	Set oDocument = CATIA.ActiveDocument

	For i=0 To 10000
		Set oPoint = oDocument.Part.HybridShapeFactory.AddNewPointCoord(0, 0, 0)
		oDocument.Part.HybridShapeFactory.DeleteObjectForDatum oPoint
	Next

End Sub

Below screens from task manager before running script, after first run and the second:
task_manager_screenshot_muum5r.png


CATDUA shows no errors, garbage collector should clean oDocument and oPoint at the end of the script, so where is the problem?

Regards
Peter
 
Replies continue below

Recommended for you

did you submit to DS as SR ?

Eric N.
indocti discant et ament meminisse periti
 
Just realized I have same problem with one script...

I'll put a counter as global parameter (so it will stay in CATIA Session) and remind user to close session if counter reach some TBD value...if user keep working with leaking script I'll change background color to RED. Final step the script will simply close catia and wish user good night!

Who said scripting was not fun [bigsmile]

Eric N.
indocti discant et ament meminisse periti
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top