×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

VBA/CATScript memory leak

VBA/CATScript memory leak

VBA/CATScript memory leak

(OP)
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 --> VBA

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:


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

Regards
Peter

RE: VBA/CATScript memory leak

did you submit to DS as SR ?

Eric N.
indocti discant et ament meminisse periti

RE: VBA/CATScript memory leak

Memory leak when running scripts? That'll teach ya.

RE: VBA/CATScript memory leak

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

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources