Skip to content

Conversation

@cslzchen
Copy link
Contributor

@cslzchen cslzchen commented Mar 29, 2018

  • This doesn't solve the memory leak when CSV are correctly rendered. Need more investigation.
  • This does significantly reduce the memory leak when TableTooBigError exception is thrown.

options=json.dumps(size),
)
# gc.collect()
raise exceptions.TableTooBigError(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Raise exception after with open() has finished.

sheets=json.dumps(sheets),
options=json.dumps(size),
)
# gc.collect()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Forcing garbage collection does not help, which is a good thing. I will remove the import and these statement after CR.

break

if table_too_big:
return None, None, nbr_rows, nbr_cols
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an ugly way of using python's flexibility. Please advise!

@cslzchen cslzchen force-pushed the bug-fix/csv-memory-leak branch from a740bf9 to cb812b9 Compare March 29, 2018 15:25
- Delay exception raising until context manager
  `with open()` has finished.
- _render_grid now returns a four element tuple
  (sheets, size, nbr_rows, nbr_cols), where the
  first two for success and the last two for the
  `TableTooLargeError`.
- Delay return until Context Manager `with open()`
  has finished and force GC in between.
- Explicitly `del` data, reader, sheets when they
  are on longer used.
@cslzchen cslzchen force-pushed the bug-fix/csv-memory-leak branch from cb812b9 to 4aed951 Compare March 29, 2018 16:06
@cslzchen cslzchen changed the base branch from develop to master March 29, 2018 16:07
@cslzchen cslzchen changed the title [WIP] [SVCS-???] Fix Memory Leak During Large CSV Exception Handling [HotFix] [SVCS-676] Fix Memory Leak During CSV Rendering Mar 29, 2018
@felliott felliott closed this in fa0c4bd Mar 29, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant