-
-
Notifications
You must be signed in to change notification settings - Fork 220
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
EventDispatcher::removeAllEventListeners types Vector is broken #2441
Comments
Why is it broken? You have provided no context to the issue. If you have code in your project that is resulting in some issue with |
I'm still not clear on what the issue actually is. Is there a crash?
The
When This means that the So, as far as I can tell, the screenshots you have provided show it working correctly. The screenshot showing the entry What is the actual problem that you are having? |
No crash, but memory leak occurs. |
Something isn't right, and it is unlikely to be in One common cause of a memory leak in user projects is if a |
I tested it with MainScene.cpp in the basic template. [memory] LEAK: object 'class ax::EventListenerKeyboard' still active with reference count 1. WARNING: Visual Leak Detector detected memory leaks!
|
That helps, thank you. Using a new project, I can now see what you are referring to. The issue is happening when an event listener is removed, it corrupts the You can see it happening here: In this you can see that the memory changes when The @halx99 Any ideas regarding this? Should we change all usage of the temporary |
This is the callstack when the memory is changed:
|
I will test it later |
Simple reproducible example of the issue:
It seems that we cannot reliably hold references to keys in a EDIT: Does this remark apply to this issue?
From: https://github.com/Tessil/robin-map?tab=readme-ov-file#differences-compared-to-stdunordered_map |
I reproduced it, and test
|
I just create a refactor PR: #2444 |
Using
If there are no downsides to doing this, then that would be great. |
Yes, I also write test case, generate 100W 10~255 string, test1: insert directly, erase 50W, test2: calc xxhash64 then insert to int64 key, erase 50W, calc xxh64 first then call map erase Debug: === Test1: string key ===
Insert: 4982 ms
Delete: 3536ms
Total: 8518ms
=== Test2: xxhash int64 key ===
Insert: 2325 ms
Delete: 1566ms
Total: 3891ms Release ( === Generating 1000000 keys ...
=== Test1: string key ===
Insert: 1914 ms
Delete: 1369ms
Total: 3283ms
=== Test2: xxhash int64 key ===
Insert: 974 ms
Delete: 778ms
Total: 1752ms Release( === Generating 1000000 keys ...
=== Test1: string key ===
Insert: 492 ms
Delete: 272ms
Total: 764ms
=== Test2: xxhash int64 key ===
Insert: 197 ms
Delete: 86ms
Total: 283ms |
Steps to Reproduce:
``
{
bool cleanMap = true;
std::vector<std::string_view> types;
......
}
types vector is broken
std::vector<std::string_view> types; -> std::vector<std::string> types;
The text was updated successfully, but these errors were encountered: