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

Closed
vicuna opened this issue Apr 20, 2016 · 4 comments
Closed

Format only flushes std_formatter by at_exit. #7235

vicuna opened this issue Apr 20, 2016 · 4 comments
Assignees

Comments

@vicuna
Copy link

vicuna 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
Copy link
Author

vicuna 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).

@github-actions
Copy link

github-actions bot commented May 9, 2020

This issue has been open one year with no activity. Consequently, it is being marked with the "stale" label. What this means is that the issue will be automatically closed in 30 days unless more comments are added or the "stale" label is removed. Comments that provide new information on the issue are especially welcome: is it still reproducible? did it appear in other contexts? how critical is it? etc.

@github-actions github-actions bot added the Stale label May 9, 2020
@dbuenzli
Copy link
Contributor

dbuenzli commented May 9, 2020

It would be a good idea to do what Furuse suggested.

@gasche
Copy link
Member

gasche commented May 9, 2020

This was in fact done by Pierre Weis in a000769 in 2018 (gone into 4.08 I think), but this issue was not closed then.

@gasche gasche closed this as completed May 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants