Answer the question
In order to leave comments, you need to log in
Why does MySQL allocate fixed memory for types?
For example, 4 bytes are allocated under the int type, although it can contain the number 5, which takes 3 bits
. Why does this not happen dynamically so that there are no leaks in the case of small numbers?
Answer the question
In order to leave comments, you need to log in
Excuse me, but how does the processor know that you meant exactly the number 5?
Well, in the sense that he is running like this through memory, stumbles upon a sequence of bits every beat of his life. How will he guess that you wanted exactly three bits under the number to allocate? He will need some clue, say some other memory location where you will write the number 3 (bits), right? But the number 3 is generally two bits (11) in the binary system. And how can he guess that you used exactly 2 bits in the hint? Do you understand what the problem is?
And generally speaking
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question