AP203 Min memory leaks

33 views
Skip to first unread message

Rob McDonald

unread,
Sep 4, 2023, 7:07:14 PM9/4/23
to scl...@googlegroups.com
Many years ago, I developed the ap203min example as a way for me to learn STEPCode and STEP.

I contributed this example to provide a template for others getting started with STEP.

Not surprisingly, my own program's use of STEPCode closely follows ap203min.  I recently realized that my program leaks memory when I run through this code.  Quickly looking at ap203min, it looks like it has the same 'feature'.

ap203min contains 56 'new' and only 3 'delete'.

For my use-case, this isn't a huge deal.  I don't expect my users to repeatedly export STEP files from a single instance of my program.  Likewise, ap203min terminates after writing a file and all memory sins vanish into the aether.

However, I'd like my program to be more clean -- and if ap203min serves as an example for others, I believe it should also be memory leak clean.

What is the canonical way of cleaning up after STEPCode?  It seems that the top-level classes do not recursively destroy things (or perhaps I'm simply missing one or two).  Is there a 'garbage clean' command I'm missing?  Do I need to add member variables to keep track of all 56 of those pointers -- and then build up my own complex destructors to clean them up in the correct reverse order?

Any suggestions here are appreciated.  I haven't looked closely at this code since it was written (~10 years ago).

Rob
Reply all
Reply to author
Forward
0 new messages