Open ghost opened 4 years ago
This is not a memory leak.
I run the code in debug mode and the line here reports
470484544 ncontrol for a spline in the hatch. Considering this creates a shared pointer to a DRW_Coord object spline's control list would hog like 13 GBs of memory. But the problem obviously is not the memory here nor the file itself (I do not think it is corrupted or anything). The convertor does not have this problem for CADs without hatch type object. The section (L1900 to L 1918 in the file above) that adds the spline must be revisited.
Other CAD files from Villa Savoye suffer from the same problem.
The issue turned out be a parsing error as I suspected. I used the DWG file spec found here to make a comparison with the actual code and there appears to be two mistakes in both this branch and to the mainline code in the SourceForge. Below is the simple patch file created by git diff of the fix.
Steps:
Cheers.
When converting the file
Ceco.NET-Architecture-Tm-271.dwg
obtained from here with dwg2dxf 1.0.1 it consumes memory at a rate of 1GB every 5 seconds or so and appears to have no limit (I killed it after 40GB)