You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As of now, linenoise uses atexit() to call free a bunch of times. It seems completely unnecessary do so, because the OS will already reclaim that memory at exit (and far more efficiently, too).
Also, using atexit() for this purpose means that if some user of the library decides to use atexit() to save linenoise history to a file, it won't work because linenoise's atexit() will practically always be called later (because it's only called once the first line is processed), and therefore its atexit() set function would be called first once the program exits, making the history written to file complete garbage.
I would suggest simply removing the freeHistory() call from linenoiseAtExit(), or removing the function altogether.
The text was updated successfully, but these errors were encountered:
As of now, linenoise uses atexit() to call free a bunch of times. It seems completely unnecessary do so, because the OS will already reclaim that memory at exit (and far more efficiently, too).
Also, using atexit() for this purpose means that if some user of the library decides to use atexit() to save linenoise history to a file, it won't work because linenoise's atexit() will practically always be called later (because it's only called once the first line is processed), and therefore its atexit() set function would be called first once the program exits, making the history written to file complete garbage.
I would suggest simply removing the freeHistory() call from linenoiseAtExit(), or removing the function altogether.
The text was updated successfully, but these errors were encountered: