Small size of executable?

New to FreeBASIC? Post your questions here.
Post Reply
maurosebastian91
Posts: 25
Joined: Mar 21, 2021 18:22

Small size of executable?

Post by maurosebastian91 »

Hello colleagues, good morning.

In the development of my little audio game, I noticed a small detail that I didn't know how to answer.

My executable combining sdl and csfml audio 2, is 51 KB, (52224 bits), and as I add more code and function calls and all that, when I check how the size has changed, it always stays the same.
It is true that I have not yet added so much information, but how can it be that it always weighs the same?

thank you,

Greetings.
jj2007
Posts: 2327
Joined: Oct 23, 2016 15:28
Location: Roma, Italia
Contact:

Re: Small size of executable?

Post by jj2007 »

52224 bytes is 51*1024 bytes. The OS (Windows, I guess) creates executables as multiples of 1024 bytes. When your code needs 50*1024+1=51201 bytes, the OS reserves 52224 bytes. You can add 1023 more bytes of code without increasing your executable size.
SARG
Posts: 1417
Joined: May 27, 2005 7:15
Location: FRANCE

Re: Small size of executable?

Post by SARG »

To complete jj2007's post
Look at file properties :
File size and size on disk. The second is equal or greater than the first.
maurosebastian91
Posts: 25
Joined: Mar 21, 2021 18:22

Re: Small size of executable?

Post by maurosebastian91 »

Thank you for your answers.

since you mention it, finally my executable increased in size, by 0.5 MB.
jj2007
Posts: 2327
Joined: Oct 23, 2016 15:28
Location: Roma, Italia
Contact:

Re: Small size of executable?

Post by jj2007 »

maurosebastian91 wrote:since you mention it, finally my executable increased in size, by 0.5 MB.
You mean 0.5kB, i.e. 512 bytes.
jj2007 wrote:The OS (Windows, I guess) creates executables as multiples of 1024 bytes
That was wrong, it's actually multiples of 512 bytes - sorry.
deltarho[1859]
Posts: 3515
Joined: Jan 02, 2017 0:34
Location: UK
Contact:

Re: Small size of executable?

Post by deltarho[1859] »

I am being pedantic - 0.5KiB. Image
Post Reply