Files and Memory Usage

T

TNguyen

From the perspective of a utility like top, would having a file open
and continuously write to it without closing it increase the memory
usage?
 
A

Andrew Thompson

TNguyen said:
and continuously write to it without closing it increase the memory
usage?

Note: When I go to reply to your message, my software
inserts a character before your text to indicate that I
am 'quoting' your words, ..see the '>' above?

The stray '>' at the beginning of your *original* message
makes it appear that *you* were also quoting someone else!

Please leave off the initial '>' in future, to help
save the confusion.

( And no, I have no idea what 'top' is, nor its behaviour
with Java I/O streams. Yoo might clarify what it is, with
a link. )

Andrew T.
 
A

Andrew Thompson

Andrew Thompson wrote:
...
( And no, I have no idea what 'top' is, nor its behaviour
with Java I/O streams. Yoo might clarify what it is, with
a link. )

I do not think I said that very clear, so a second attempt..

I suggest you post a link to the 'top' tool that you
are using, so others (who may not know what it is)
can find out about it, and be able to better answer your
question.

Andrew T.
 
S

sgoo

Well, I believe he is talking about the very very basic *nix tool --
/usr/bin/top.

I don't know the answer to the question, but it should be very easy to
write a program to test it.
 
M

Mark Rafn

TNguyen said:
From the perspective of a utility like top

Top is darned handy, but you shouldn't optimize for any given tool.
Understand what the tool is measuring and decide if it's important to you
(note: top's VIRT and RES numbers probably should be important to you most of
the time, but not because they're in top, just because OS memory allocated and
resident is important).
would having a file open and continuously write to it without closing it
increase the memory usage?

Not usually. You can write many gigs to a file without using any more
memory for the VM. There may be files or filesystems where this is not true
(some sort of virtual filesystem that lives in the VM, maybe?), but if you're
seeing memory grow, it's far more likely you're leaking memory (leaking
object references, usually, through a misplaced or hidden static) when
reading/generating/writing the data than that the actual write is using
memory.
 
L

Lars Enderin

Andrew Thompson skrev:
Note: When I go to reply to your message, my software
inserts a character before your text to indicate that I
am 'quoting' your words, ..see the '>' above?

The stray '>' at the beginning of your *original* message
makes it appear that *you* were also quoting someone else!
Many mail and news agents will put a > in front of From if it starts a
line, since a line starting with From may be the start of a new message
in some mail/news archive and transport formats.
 
A

Andrew Thompson

Lars said:
Andrew Thompson skrev:
Many mail and news agents will put a > in front of From if it starts a
line, since a line starting with From may be the start of a new message
in some mail/news archive and transport formats.

It took me a few moments to realise the significance
of what you were saying, since I'd forgotten the OP's
use of the word 'From', and thought you were using it
in a more generic sense.

It would be interesting to find out if it was the news
reader. ..oh wait a second, GG! OK.
<http://groups.google.com/group/alt.test/browse_frm/thread/588afb7279a7b824/ec9393e87967e7fc>

Proof you were right Lars, that post by me to alt.test,
out of GG, had no leading '>' when I sent it.

Andrew T.
 
D

Daniel Pitts

( And no, I have no idea what 'top' is, nor its behaviour
with Java I/O streams. Yoo might clarify what it is, with
a link. )

Andrew T.

top is a standard Unix command which is similar to windows task
manager. It displays memory and CPU statistics for running
applications. I believe the OP is asking if continuously writing to a
file will increase the apparent memory usage of a particular
application.

My short answer is, probably not. Although, the OS might cache
some/all of the writes, and therefor allocate memory. Although,
generally, if you are going to write to a file throughout the lifetime
of an application (say for a log) then keeping the file open DOES make
sense.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top