Skip to content

Is there a way to limit the maximum unmanaged memory allocated ? #2829

Answered by antonfirsov
Socolin asked this question in Q&A
Discussion options

You must be logged in to vote

SimpleGcMemoryAllocator might give you what you want, but it will hurt performance.

Another workaround that just came into my mind is to implement a tracking allocator that wraps MemoryAllocator.Default.

Here is a poorly tested prototype:
https://gist.github.com/antonfirsov/05ce2d02a04134ab0879a19c345ed71e

Does this look like a reasonable workaround?

Replies: 2 comments 9 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
9 replies
@antonfirsov
Comment options

@Socolin
Comment options

@Socolin
Comment options

@antonfirsov
Comment options

Answer selected by Socolin
@Socolin
Comment options

@antonfirsov
Comment options

@Socolin
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants