pplu / cfn-perl

An object model for CloudFormation documents
Other
0 stars 5 forks source link

Update Cfn fails due to memory leak #71

Open gamusinoo opened 2 years ago

gamusinoo commented 2 years ago

Hi!

we are trying to update Cfn to latest CF spec available. Seems there is a memory leak issue that kills the process, and the class generation does not finish.

This is happening since CF spec 35.0.0 version, and also it was already reported in a previous issue (already closed):

issue 69 - Update Cfn to latest CF spec

Would you be able to have a look at it, or provide further assistance?

Thank you!

pplu commented 2 years ago

Hi,

Would you be able to have a look at it, or provide further assistance?

I am not actively maintaining Cfn right now, as my daily work doesn't require it. I accept pull requests, and publish them to CPAN when I'm confortable with them. Contractor work can be arranged on Cfn if needed.

we are trying to update Cfn to latest CF spec available. Seems there is a memory leak issue that kills the process, and the class generation does not finish.

The generation bit of Cfn is very memory hungry, as it converts the spec JSON into a full-blown object model. Since it is constantly copying pieces of the spec, and converting pieces to objects. These objects are not liberated once used to generate the Perl code. I think it can be optimized so that the generation can have less memory usage. Have you tried generating with lots of RAM? Maybe instrumenting the generation code to see how RAM gets allocated with number of CloudFormation resources / attributes of CloudFormation resources can give you a good idea if memory is being alllocated.