Limit / Measure Juliaprogram Memory / RAM consumption

I want to write a program where I can specify the maximum amount of RAM it can use after startup. I therefore need a function that shows me the current value of RAM that the running program is currently using.

Can someone help me with this?

The functions under
do not seem to be suitable for this.

julia --heap-size-hint ?

This thread might help. I was going to suggest looking at /proc//statm but that is Linux specific

Thanks for pointing that out, because it’s a start. Julia should get something built in to solve this elegantly for all operating systems uniformly