Take the 2-minute tour ×

i did some modification on my project windowservice. Previously it was 56kb. But after modification its size decreased to 54kb.Actually modification increased number of coding,then why size is decreasing, Any idea about this feature

share|improve this question
Without seeing the code, or even the changes, it's impossible to say for sure. –  Ken Dec 19 '09 at 20:53
add comment

4 Answers

The changes you made in your source code are generating smaller machine code by their nature, or a compile time option could have been changed.

Or, the filesystem could be aligning the file based on the number of blocks it takes up.

share|improve this answer
add comment

Not necessary mata info. Section alignment has probably change (of course this include meta). Check section sizes using DUMPBIN command, for compare old and new executable.

It can be inline optimizion. If compiler choise that this method is too big for inline optimizion it won't be copy code every calling places. This will decrease filesize.

VC uses 512 bytes to round executable. So dropping one string off can reduce file size 512 bytes (if you are lucky).

share|improve this answer
my question is why size decreasing –  peter Dec 19 '09 at 18:34
add comment

There is no obvious correlation between lines of C# code and the IL that's generated for them. Especially anonymous methods, lambdas, iterators and Linq queries can be very compact in C# but generate a lot of IL. You'd have to use ildasm.exe to get to the bottom of it. If you'd really want to find out...

share|improve this answer
my question is why size decreasing –  peter Dec 19 '09 at 18:33
Because you used less of those expensive constructs? I don't know, you forgot to say what you changed. –  Hans Passant Dec 19 '09 at 18:35
i am sending some attributes which contain some string value from a service which has installer class and can see in services.msc to another windowservice which doesnt have installer class and is called internally by another serverservice which has installer class –  peter Dec 19 '09 at 18:40
Peter, the point nobugz is making, is that you might have removed two lines of code that resolved to ten lines of IL, while adding five lines of code that resolved to five lines of IL, resulting in a net reduction in file size. Evaluate the IL before and after the change to find out. –  Michael Petrotta Dec 19 '09 at 18:44
No i didnt removed any single line of code thats what the interesting thing –  peter Dec 19 '09 at 19:06
show 1 more comment

If you're looking at the size of the executable, then it's because the size of the meta information changed.

If you're looking at the in-memory size like with TaskMgr, then it's probably because it's executing a little differently due to runtime history.

share|improve this answer
add comment

Your Answer


