As @DA01 answered, DPI on the JPG-files are only meta-information, or instructions for the printer. No matter what you set the DPI, it usually (always) can be overridden by the publishing software. Changing the DPI shouldn't change the file size—if other settings are intact.
If other settings are intact, which they usually aren't when saving a JPG with a different software/device. For example camera might have different saving algorithm, Photoshop another and IrfanView another. On top of this: every time you save your JPG, it gets recompressed, even with the quality @ 100 % (in which case the image quality may be the same, but due to the algorithm file size increases).
I conducted a little hands-on experiment with a JPG photograph and saved it with Photoshop and IrfanView. The results:
> DIR /O:D
21.01.2011 14:48 4 454 896 original.jpg
20.07.2011 12:51 5 956 156 photoshop q12.jpg
20.07.2011 12:51 5 476 259 photoshop q12 optimized.jpg
20.07.2011 12:52 5 414 704 photoshop q12 progressive-5.jpg
20.07.2011 12:53 5 731 409 irfanview q100.jpg
20.07.2011 12:53 5 731 409 irfanview q100 dpi600.jpg
20.07.2011 12:54 5 913 515 irfanview q100 resaved with dpi600.jpg
20.07.2011 12:54 5 470 243 irfanview q100 progressive.jpg
20.07.2011 12:55 1 174 717 irfanview default (q80).jpg
original.jpg is a JPG from the camera (DPI is set at 72)
photoshop q12.jpg is the original JPG resaved with quality "12", which is the maximum in Photoshop
photoshop q12 optimized.jpg is the original JPG resaved with max quality and "optimized" algorithm
photoshop q12 progressive-5.jpg is the original JPG resaved with max quality and "progressive 5 scans" setting
Notice how the file size increased when the original file was resaved in Photoshop with max quality and with any of the optimization settings—this is due to the recompressing.
Now the IrfanView's files:
irfanview q100.jpg is the original JPG resaved with quality "100", which is the maximum in IrfanView
irfanview q100 dpi600.jpg is the original JPG resaved with max quality and DPI set to 600.
irfanview q100 re-saved with dpi600.jpg is the aforementioned irfanview q100 JPG file resaved with max quality and DPI set to 600.
Notice how the
q100 dpi600.jpg file sizes are exactly the same. And again, due to recompressing, a q100 file resaved with q100 increases the file size.
Just for comparison to Photoshop's progressive-JPG, there's also IrfanView's progressive JPG file (I'm unsure how many scans it's set to).
Also note that the default quality in IrfanView is 80, which is in most cases very "cost-effective" for the final output. Opening
original.jpg in IrfanView and saving it with q80 decreased the file size, in this case, to about 26 % of the original.