? Two Different Memory Sizes Listed for a File

  • Thread starter Thread starter Nehmo
  • Start date Start date
N

Nehmo

When you look at the properties of a file in Windows XP Explorer, it
lists two sizes: Size, and Size on disk. The Size on disk is larger by
a fraction. What's the explanation of this?

In Corel Paint Shop Pro X, when I look at image information, there's
two sizes there too. I see On disk, and In RAM. The In RAM amount is
ten times larger than the On disk amount for one jpeg. What's the
explanation of this?
 
Nehmo said:
When you look at the properties of a file in Windows XP Explorer, it
lists two sizes: Size, and Size on disk. The Size on disk is larger by
a fraction. What's the explanation of this?

In Corel Paint Shop Pro X, when I look at image information, there's
two sizes there too. I see On disk, and In RAM. The In RAM amount is
ten times larger than the On disk amount for one jpeg. What's the
explanation of this?

Jpgs must be decompressed to be loaded in to ram.
 
Nehmo said:
When you look at the properties of a file in Windows XP Explorer, it
lists two sizes: Size, and Size on disk. The Size on disk is larger by
a fraction. What's the explanation of this?


Space is allocated on disk drives in units called clusters. The size of the
cluster varies with the file system, and sometimes with the size of the
partition.

If you're using NTFS, your cluster size is probably 4K. That means that
every file between 1 byte and 4096 bytes (size) uses one cluster, 4096 bytes
(size on disk). Every file between 4097 bytes and 8192 bytes uses two
clusters, 8192 bytes, and so on.


The difference between the size and the size on disk is called "cluster
overhang" or "slack," and that's what accounts for the difference in the two
numbers you see.
 
When you look at the properties of a file in Windows XP Explorer, it
lists two sizes: Size, and Size on disk. The Size on disk is larger by
a fraction. What's the explanation of this?

In Corel Paint Shop Pro X, when I look at image information, there's
two sizes there too. I see On disk, and In RAM. The In RAM amount is
ten times larger than the On disk amount for one jpeg. What's the
explanation of this?

Please don't crosspost. If you must post to more than one group,
than do so in separate posts. Otherwise, you might find yourself
not getting responses from many who could assist with your
question.

Any compressed image (like jpg, for example) has a file size on
disk that reflects its compressed size. When it is opened in an
image editor it is opened as an uncompressed bitmat. That's why it
occupies much more space in ram.

As to the fractional size difference in Windows Explorer, I believe
it's a rounding error.

Regards,

JoeB
 
Jpgs must be decompressed to be loaded in to ram.

Re your first Q: the difference is the unused space in the last disk
block occupied by the file, the "slack fill."
 
Nehmo said:
When you look at the properties of a file in Windows XP Explorer, it
lists two sizes: Size, and Size on disk. The Size on disk is larger by
a fraction. What's the explanation of this?

In Corel Paint Shop Pro X, when I look at image information, there's
two sizes there too. I see On disk, and In RAM. The In RAM amount is
ten times larger than the On disk amount for one jpeg. What's the
explanation of this?

On a hard disk each file is stored in a number of clusters. Almost
always the last cluster is not completely filled, and the empty space
cannot be used by another file. The size on disk is the total size of
all the clusters used to store the file.
For instance, on my computer the F: drive is an 80GB drive that is
formatted in FAT32. The cluster size is 32KB. One particular file there
has a size of 103KB and a size on disk of 128KB, which is the total size
of the four 32KB clusters that the file occupies.
This can become very wasteful of disk space if you have a large cluster
size and many small files. For instance, I have a folder that contains
522 small data files that are all around 2KB (or a little less). In the
properties for that folder, the size is listed as 960KB. But the size on
disk is 16.3MB (17,104,896 bytes). This because each 2KB file occupies a
single 32KB cluster and 522 times 32KB (32,768 bytes) gives 17,104,896
bytes.
This is one of the advantages of the NTFS file system. It usually uses a
4KB cluster size, which means that folder with 522 small files only
takes up 2.03MB (522 x 4K) when it is stored on an NTFS formatted drive.
The other solution is to store the folder as a single zip file... then
with compression, and only one partly filled cluster for the single
file, it takes up only 633KB or 640KB on disk.
 
JoeB said:
Please don't crosspost. If you must post to more than one group,
than do so in separate posts. Otherwise, you might find yourself
not getting responses from many who could assist with your
question.

<follow-ups restored>

OP, Thank you for cross-posting instead of making separate posts. When you
make separate posts, you can't see all the responses in a single thread.

Oh yeah, ignore ****wits who tell you to not cross-post and then trim the
newsgroups in their follow-ups.
 
Today, with great enthusiasm and quite emphatically, Damian laid
this on an unsuspecting readership ...
<follow-ups restored>

OP, Thank you for cross-posting instead of making separate
posts. When you make separate posts, you can't see all the
responses in a single thread.

Oh yeah, ignore ****wits who tell you to not cross-post and
then trim the newsgroups in their follow-ups.
JoeB, you listening? he he he
 
Please don't crosspost.

Get stuffed. No please, that's an order.
If you must post to more than one group, than do so in separate posts.

Get stuffed. It makes a lot more sense to crosspost because those
reading more than one of the newsgroups see it marked as read
in the other newsgroups after they have read it in the first one.
Otherwise, you might find yourself not getting responses
from many who could assist with your question.

Only a few fools. He clearly got plenty of perfectly adequate responses.
Any compressed image (like jpg, for example) has a file size on
disk that reflects its compressed size. When it is opened in an
image editor it is opened as an uncompressed bitmat. That's why it
occupies much more space in ram.
As to the fractional size difference in Windows
Explorer, I believe it's a rounding error.

You're wrong, its due to the used space in the last cluster.
 
Hi Nehmo,

The answer to your query is what Ken Blake MS-MVP, among many others have
stated--I wondered that myself for a while.

I'm apologizing for "malcontents" (had a "better" word in mind) like Rod
Speed. Even though you may have breached the "rules" of Usenet etiquette, I
don't find being insulting to be of any help either.

Just FYI Nehmo, the following article is worth the quick read, to understand
why some nitpickers are/were so P.O.ed.:
http://www.blakjak.demon.co.uk/mul_crss.htm
Hope this helps,
--
Curt BD-MVBT

http://dundats.mvps.org/
http://dundats.proboards27.com/index.cgi
http://www.aumha.org/
 
Curt Christianson said:
I'm apologizing for "malcontents" (had a "better" word in mind) like Rod Speed.

You dont get to apologise for anyone at all, ****wit.
Even though you may have breached the "rules" of Usenet etiquette,

No such animal. Usenet is as close to pure
anarchy as you or I will ever see, child.
I don't find being insulting to be of any help either.

You have always been, and always will be, completely and
utterly irrelevant. What you may or may not 'find' in spades.
 
Rod Speed said:
You dont get to apologise for anyone at all, ****wit.


No such animal. Usenet is as close to pure
anarchy as you or I will ever see, child.


You have always been, and always will be, completely and
utterly irrelevant. What you may or may not 'find' in spades.

Come out and fight, pussyboy. You won't, will you? Ya ****ing chicken.
 
JoeB said:
Please don't crosspost. If you must post to more than one group,
than do so in separate posts. Otherwise, you might find yourself
not getting responses from many who could assist with your
question.

Any compressed image (like jpg, for example) has a file size on
disk that reflects its compressed size. When it is opened in an
image editor it is opened as an uncompressed bitmat. That's why it
occupies much more space in ram.

As to the fractional size difference in Windows Explorer, I believe
it's a rounding error.

Regards,

JoeB

1. Crossposting is way preferable to multiposting.
2. Don't edit the newsgroup list without saying so.
3. You don't have any idea what causes the difference. See Ken's post.
 
the person in charge said:
2. Don't edit the newsgroup list without saying so.

**** you and **** the camel you rode in on.



--
alt.usenet.kooks - Pierre Salinger Memorial Hook, Line & Sinker:
September 2005 and April 2006

ObHint: Just because you argue with a notorious ****wit netk0oK, it
does not necessarily follow that you are not also a ****wit netk0oK.
 
Jpgs must be decompressed to be loaded in to ram.

That is complete nonsense. The on-disk size is larger, because
in the filesystem used you have aminimal allocation unit, like
16kB. File size on disk is rounded up to multiples of the allocation
unit size. Very modern filesystems like RaiserFS 4, for example
can use the space that is free in the last allocation
unit to in fact kae only the space needed, but since this
degrades performance, it is only used if you have a very large
number of small files.

Arno
 
Today, with great enthusiasm and quite emphatically, Arno Wagner
laid this on an unsuspecting readership ...
That is complete nonsense. The on-disk size is larger, because
in the filesystem used you have aminimal allocation unit, like
16kB. File size on disk is rounded up to multiples of the
allocation unit size. Very modern filesystems like RaiserFS 4,
for example can use the space that is free in the last
allocation unit to in fact kae only the space needed, but
since this degrades performance, it is only used if you have a
very large number of small files.
Why is it nonsense to say a JPEG must be decompressed to load
into RAM, or more correctly, into the unformatted bitmap of any
graphics app? At a minimum, one needs 3 X number of pixels for
bytes in memory, plus any non-graphics info such as EXIF, so I
see no inconsistency between a highly compressed JPEG's on-disk
KB and the claimed 10X in-memory size.

What IS nonsense is claiming that block size causes the file size
to balloon up. It is true that in very large partition sized HDs,
block size can become an issue, but only for very small files.
For a moderate or large file size in KB, block size overhead is
neglible.
 
Arno said:
That is complete nonsense. The on-disk size is larger, because
in the filesystem used you have aminimal allocation unit, like
16kB. File size on disk is rounded up to multiples of the allocation
unit size. Very modern filesystems like RaiserFS 4, for example
can use the space that is free in the last allocation
unit to in fact kae only the space needed, but since this
degrades performance, it is only used if you have a very large
number of small files.

This is all well and good but it does not explain the observed behavior.
 
Nehmo said:
When you look at the properties of a file in Windows XP Explorer, it
lists two sizes: Size, and Size on disk. The Size on disk is larger by
a fraction. What's the explanation of this?

Answered already.
In Corel Paint Shop Pro X, when I look at image information, there's
two sizes there too. I see On disk, and In RAM. The In RAM amount is
ten times larger than the On disk amount for one jpeg. What's the
explanation of this?

When a JPEG is loaded into Paint Shop Pro it is uncompressed into device
independent bitmap. A JPEG's size can vary widely depending on the
detail in the image and the amount of compression that was used when it
was created, but the aim is to greatly reduce file size. When the image
is loaded into PSP to be available for editing, every pixel needs to
represented by three bytes of memory... one each for red, green and
blue.
From my camera, the images are 3008 x 2000 pixels, and file size of a
high quality JPEG is usually around 2.5MB. When this is uncompressed
into the array of pixels that an image editor needs, there are 6,016,000
pixels each needing 3 bytes to represent it... a total of 18,048,000
bytes (17.2MB).
 
Back
Top