1

I am aware that I can get the memory used with

memory_get_peak_usage();

but is there a way to tell in advance how much memory an array will need?

Thanks!

2
  • Check this: stackoverflow.com/questions/1351855/… Simmilar problem solved Commented Jun 11, 2019 at 9:59
  • Thanks but I am looking for a way to get the memory needed BEFORE executing the function. So I want to calculate the estimated memory needed beforehand. Commented Jun 11, 2019 at 10:02

1 Answer 1

1

This is not possible with a built-in function.

You need to know what is beeing stored inside the array and from that on you could calculate the memory needed.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.