Skip to content

Commit

Permalink
Fix memory leaks
Browse files Browse the repository at this point in the history
Reduce definitely lost

Before:

  ==5836== LEAK SUMMARY:
  ==5836==    definitely lost: 99,435 bytes in 549 blocks
  ==5836==    indirectly lost: 101,154,375 bytes in 881,013 blocks
  ==5836==      possibly lost: 173,778 bytes in 1,678 blocks
  ==5836==    still reachable: 20,033,236 bytes in 82,359 blocks

After:

  ==7294== LEAK SUMMARY:
  ==7294==    definitely lost: 93,155 bytes in 498 blocks
  ==7294==    indirectly lost: 88,383,626 bytes in 772,926 blocks
  ==7294==      possibly lost: 71,891 bytes in 902 blocks
  ==7294==    still reachable: 20,016,025 bytes in 82,184 blocks
  ==7294==                       of which reachable via heuristic:
  • Loading branch information
kenhys committed Jun 14, 2024
1 parent ad5c2cd commit 241cf89
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/virtualkeyboardcustom.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ class CustomKeyboard : public I18nKeyboard {
label_ = loader_->label();
languageCode_ = std::string(loader_->languageCode());
}
~CustomKeyboard() { delete loader_; }
int mode() { return mode_; }
void switchMode();
bool isAdditionalMarkOn() const { return isAdditionalMarkOn_; }
Expand Down
7 changes: 7 additions & 0 deletions src/virtualkeyboardlayout.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,13 @@ class KeyboardLayout {
}
}

~KeyboardLayout() {
keys_.clear();
stateLabels_.clear();
modeLabels_.clear();
modeActions_.clear();
modeOffsets_.clear();
}
// Keyboard metadata
const char *label() { return label_; }
const char *languageCode() { return languageCode_; }
Expand Down

0 comments on commit 241cf89

Please sign in to comment.