Memory computing and memory computing

Source: Internet
Author: User

Memory computing and memory computing

Because I often take MLE exams, I would like to summarize the content related to memory computing.

Memory Calculation Formula

Memory = number of variables * bytes occupied by the variable type/1024/1024 (M)

Bytes occupied by common variable types
Bool 1
Char 1
Int 4
Long 8
Double 8
Long double 12
Short 2
Float 4

 

 

 

 

 

 

 

 

 

 

 

 

If you forget it, you can use the sizeof function to view it.

1 printf ("% d", sizeof ());

 

Memory occupied by common array sizes

All types are int. Unit: M.

1e6 + 10 3.81473541259765625
1e7 + 10 38.14701080322265625
1e8 + 10 381.46976470947265625
(1e3 + 10) * (1e3 + 10) 3.8913726806640625
(1e4 + 10) * (1e4 + 10) 382.2330474853515625
   

 

 

 

 

 

 

 

 

 

 

Then MLE should eat shit ..

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.