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

attempt to fix some memory leaks #119

Merged
merged 1 commit into from
Dec 18, 2024

Conversation

otavepto
Copy link
Contributor

this introduces a simple/cheap managed memory allocator, each allocated object is given a due/deadline time, after which the object is deallocated.
this memory manager relies on constant polling, just like the rest of the steam ecosystem, meaning that it doesn't spawn any threads and so it becomes the responsibility of the containing class.

if the containing class failed to perform this polling operation, the behavior becomes similar to simply using the new operator and storing the addresses (as if we were using std::vector<void *>), and since the allocator stores a reference to all allocated objects at least they will be deallocated once the containing class itself is destroyed.

I don't know for how long should these objects stay alive though, so I set each one to a comically large number.

used in:

  • Steam_Remote_Storage::GetFileNameAndSize() (also removes the 300 chars filename limit)
  • Steam_Matchmaking_Servers::GetServerDetails()
  • Steam_Remote_Storage::GetUGCDetails()

feel free to reject this PR if it seems unsafe, it's understandable that this might be problematic.

…()`, `Steam_Matchmaking_Servers::GetServerDetails()`, `Steam_Remote_Storage::GetUGCDetails()` to avoid leaking memory
@Detanup01
Copy link
Owner

Need to test the stuff if good or not. (So games doesn't break with it, etc)
Desposing after class disposed is good.

@Detanup01
Copy link
Owner

I just merge it.
Thanks wizard!

@Detanup01 Detanup01 merged commit 958368e into Detanup01:dev Dec 18, 2024
62 checks passed
@otavepto otavepto deleted the patch/timed-alloc branch December 19, 2024 00:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants