Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Format only flushes std_formatter by at_exit. #7235

Open
vicuna opened this issue Apr 20, 2016 · 1 comment

Comments

Projects
None yet
2 participants
@vicuna
Copy link

commented Apr 20, 2016

Original bug ID: 7235
Reporter: furuse
Assigned to: @pierreweis
Status: assigned (set by @damiendoligez on 2017-02-23T15:29:02Z)
Resolution: open
Priority: normal
Severity: minor
Version: 4.02.3
Category: standard library
Monitored by: @gasche

Bug description

I have just noticed that the following code of stdlib/format.ml:

(* Output everything left in the pretty printer queue at end of execution. *)
let () = at_exit print_flush

This code only flushes Format.std_formatter. I am not sure it is easily possible to flush all the formatters associated with out_channels alive when at_exit is called but at least we can flush Format.err_formatter here too.

@vicuna

This comment has been minimized.

Copy link
Author

commented Jun 7, 2018

Comment author: @pierreweis

Thank for the report.

Indeed, we should also flush err_formatter at end of program.

Extending this benavior to all formatters created by the library is more problematic since it could lead to excessive memory consumption (keeping track of all allocated formatters in a list or adding a closure for each new formatter to the list of thunks to execute at exit).

@vicuna vicuna added the stdlib label Mar 14, 2019

@vicuna vicuna added the bug label Mar 20, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.