-
Notifications
You must be signed in to change notification settings - Fork 550
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
D_BIndVariables memory leak fix proposal. #1491
base: master
Are you sure you want to change the base?
Conversation
refactor string copy from tag allocations.
Sorry, but I somehow fail to see the memory leak and how this approach could solve it. 🤷 |
master gives with the changes, it no longer appears. |
Yes, sure, this silences a valgrind warning, because |
@@ -333,7 +333,6 @@ void Z_FreeTags(int lowtag, int hightag) | |||
} | |||
|
|||
|
|||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change doesn't belong here.
I'm not sure this is a good idea. There were some issues where demo reproducibility depended on size of the memory pool. Does anyone know if the same will happen when we change what goes in there? Also this doesn't really fix the leak, it just goes inside the memory pool. It will still conceptually leak if no-one cleans it out. How would this interact with any fix to #1389? |
We shouldn't let this affect our decision - if a demo's sync depends on heap allocations then we need a more robust solution anyway. We already do different heap allocations to vanilla anyway and I'd rather not rely on fragile solutions to problems. |
@@ -69,5 +70,14 @@ unsigned int Z_ZoneSize(void); | |||
#define Z_ChangeTag(p,t) \ | |||
Z_ChangeTag2((p), (t), __FILE__, __LINE__) | |||
|
|||
static inline char* Z_StringCopy(const char *src, int tag) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The function name is confusing because it's more equivalent to M_StringDuplicate
in my opinion.
But I'm not convinced we should be using the zone heap to allocate strings anyway. That's really for larger allocations like WAD lumps and things that need to be efficiently allocated and cached while the game is running. Should we just switch to using the normal C heap for the dehacked string table?
refactor string copy from tag allocations.