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

Linux build has a memory leak. #60

Closed
matyalatte opened this issue Nov 23, 2024 · 1 comment
Closed

Linux build has a memory leak. #60

matyalatte opened this issue Nov 23, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@matyalatte
Copy link
Owner

In the console window for the GTK build, a temporary buffer (char* markup_str) is not freed.

tuw/src/string_utils.cpp

Lines 619 to 647 in ffbad17

void Log(const char* str) {
int markup_length = ConvertAnsiToPangoLength(&m_tag_stack, str);
char *markup_str = new char[markup_length + 1];
ConvertAnsiToPango(&m_tag_stack, str, markup_str);
if (m_log_entry == NULL) {
m_log_buffer += markup_str;
} else {
if (m_buffer_length + markup_length > MAX_LOG_BUFFER_SIZE) {
m_buffer_length = 0;
char* text = uiMultilineEntryText(m_log_entry);
if (text) {
int text_len = strlen(text);
if (text_len > MAX_LOG_BUFFER_SIZE / 2) {
m_buffer_length = MAX_LOG_BUFFER_SIZE / 2;
uiMultilineEntrySetText(m_log_entry,
text + text_len - MAX_LOG_BUFFER_SIZE / 2);
} else {
uiMultilineEntrySetText(m_log_entry, "");
}
uiFreeText(text);
} else {
uiMultilineEntrySetText(m_log_entry, "");
}
}
m_buffer_length += markup_length;
uiUnixMultilineEntryMarkupAppend(m_log_entry, markup_str);
uiUnixMuntilineEntryScrollToEnd(m_log_entry);
}
}

Problems may occur when executing commands that output tons of strings on Linux.

@matyalatte matyalatte added the bug Something isn't working label Nov 23, 2024
@matyalatte
Copy link
Owner Author

Fixed at #59

@matyalatte matyalatte pinned this issue Nov 23, 2024
@matyalatte matyalatte unpinned this issue Dec 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant