-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
buffer for stdout is heap-allocated #139006
Copy link
Copy link
Closed as not planned
Labels
A-allocatorsArea: Custom and system allocatorsArea: Custom and system allocatorsA-runtimeArea: std's runtime and "pre-main" init for handling backtraces, unwinds, stack overflowsArea: std's runtime and "pre-main" init for handling backtraces, unwinds, stack overflowsC-discussionCategory: Discussion or questions that doesn't represent real issues.Category: Discussion or questions that doesn't represent real issues.T-libsRelevant to the library team, which will review and decide on the PR/issue.Relevant to the library team, which will review and decide on the PR/issue.
Metadata
Metadata
Assignees
Labels
A-allocatorsArea: Custom and system allocatorsArea: Custom and system allocatorsA-runtimeArea: std's runtime and "pre-main" init for handling backtraces, unwinds, stack overflowsArea: std's runtime and "pre-main" init for handling backtraces, unwinds, stack overflowsC-discussionCategory: Discussion or questions that doesn't represent real issues.Category: Discussion or questions that doesn't represent real issues.T-libsRelevant to the library team, which will review and decide on the PR/issue.Relevant to the library team, which will review and decide on the PR/issue.
Type
Fields
Give feedbackNo fields configured for issues without a type.
While playing around with global allocators, I noticed that this code fails.
A message is printed:
memory allocation of 1024 bytes failed, and then the program terminates. Removing the line withprintln!fixes this, so I assume that it is trying to allocate 1 KiB and then crashing when it can't.However, there's no need to allocate memory here, because the string to be printed is static. So although this isn't strictly a bug, it certainly might be considered a performance issue in a IO-heavy program.