1. Newbie: In memory 4 times bigger?

Am I correct in assuming that if a file is 1000 bytes big on disk, that when it
is read into memory (with get_bytes()), it will take up 4000 bytes of memory?

Brent

new topic     » topic index » view message » categorize

2. Re: Newbie: In memory 4 times bigger?

That is true.

If you want to do operations on files that may be to large to hold in
memory at once, I suggest that you only read into memory the bit that
you are working on, and leave the rest of it in the file.

For instance, database managers rarely keep the entire database file
in memory. They hold the indexes in memory, and use them to figure out
where the record they need is in the file, seek() to that point, and
just read that into memory.


On Mon, 14 Feb 2005 18:26:52 -0800, Brent W. Hughes
<guest at rapideuphoria.com> wrote:
> 
> posted by: Brent W. Hughes <bwh566 at yahoo.com>
> 
> Am I correct in assuming that if a file is 1000 bytes big on disk, that when
> it is read into memory (with get_bytes()), it will take up 4000 bytes of memory?
> 
> Brent
> 
> 
> 
> 


-- 
MrTrick

new topic     » goto parent     » topic index » view message » categorize

3. Re: Newbie: In memory 4 times bigger?

Brent W. Hughes wrote:
> 
> Am I correct in assuming that if a file is 1000 bytes big on disk, that when
> it is
> read into memory (with get_bytes()), it will take up 4000 bytes of memory?
> 
> Brent
> 
if you read it all directly into a sequence yes. 

You can allocate a memory block to store it, process a porion at a time,
 or compress the sequence 


--"ask about our layaway plan".
--

new topic     » goto parent     » topic index » view message » categorize

4. Re: Newbie: In memory 4 times bigger?

On Mon, 14 Feb 2005 18:26:52 -0800, "Brent W. Hughes"
<guest at RapidEuphoria.com> wrote:

>Am I correct in assuming that if a file is 1000 bytes big on disk, 
>that when it is read into memory (with get_bytes()), it will take up 
>4000 bytes of memory?

Yes. If you /really/ wanted to, you could quite easily allocate some
memory, CreateFile, ReadFile, CloseHandle, and peek and poke at it, or
even use file mapping. But don't expect it to be any faster. Perform
some experiments on large files (using standard Euphoria methods)
before reaching any conclusion, or are you already experiencing a
problem?

Pete

new topic     » goto parent     » topic index » view message » categorize

5. Re: Newbie: In memory 4 times bigger?

Pete:  No, I'm not experiencing a problem with it. It just caught me a little
off guard. I hope I didn't sound like I was complaining.

Brent

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu