Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / December 2006

Tip: Looking for answers? Try searching our database.

Files and Memory Usage

Thread view: 
TNguyen - 08 Dec 2006 23:42 GMT
>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?
Andrew Thompson - 09 Dec 2006 01:34 GMT
> >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?

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.
Andrew Thompson - 09 Dec 2006 01:37 GMT
..
> ( 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.
sgoo - 09 Dec 2006 03:41 GMT
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.
Lars Enderin - 09 Dec 2006 06:47 GMT
Andrew Thompson skrev:
>> >From the perspective of a utility like top, would having a file open
>> and continuously write to it without closing it increase the memory
[quoted text clipped - 6 lines]
> 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.
Andrew Thompson - 09 Dec 2006 07:53 GMT
> Andrew Thompson skrev:
> >> >From the perspective of a utility like top, would having a file open
[quoted text clipped - 11 lines]
> 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/ec939
3e87967e7fc
>

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

Andrew T.
Daniel Pitts - 10 Dec 2006 02:45 GMT
> > >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?

> ( 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.
Mark Rafn - 09 Dec 2006 05:30 GMT
>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.
--
Mark Rafn    dagon@dagon.net    <http://www.dagon.net/>
EJP - 10 Dec 2006 03:28 GMT
>>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?

If you are using an ObjectOutputStream, yes, otherwise no.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.