Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Where are images stored and how much memory?

Author
Message
glint
21
Years of Service
User Offline
Joined: 9th Feb 2004
Location: the Synth
Posted: 20th Jul 2004 10:42
I have two questions:

Where are images stored? Are they in RAM or video memory?

What is the equation to use to determine how much memory an image occupies? I'm working with bitmaps.
bitJericho
22
Years of Service
User Offline
Joined: 9th Oct 2002
Location: United States
Posted: 20th Jul 2004 12:05
for bitmaps it's really simple... 3 color channels and depending on the way you save it, 128 or 256 shades per channel... multiply the image dimensions together and multiplay that time 128 or 256 times 3 color channels... now this formula is a little different if you use a color pallette...but at any rate that gives you the size of the image...and in actuallity, you can see the size by right clicking and hitting properties on the image itself.. if you load it uncompressed, that's how much memory it would consume. and also depending on the way you load the image (the optional tag on the LOAD IMAGE command), it could be in either ram or video memory..

The Unofficial DarkBASIC Magazine : http://www.dbspot.com/j2dstudios/
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 20th Jul 2004 21:20
I'm not sure that answered the question ...

If you are using 16 bit colour to display, each pixel is 2 bytes in size. If you are using 32 bit colour, then each pixel is 4 bytes instead.

Take that number and multiply it by both the width and the height (each rounded up to the nearest power of 2) of the image. That's how much space the actual image itself will take up.

If you have used the optional texture flag, then that's the final size. If you haven't then DirectX will generate up to 9 mipmap levels for that image (I think so at least), meaning up to an extra 33% to this size is required to store the image.

All of the checks I've run seem to indicate that images are allocated in system memory on my machine

*** Coming soon - Network Plug-in - Check my site for info ***
For free Plug-ins, source and the Interface library for Visual C++ 6, .NET and now for Dev-C++ http://www.matrix1.demon.co.uk
OSX Using Happy Dude
21
Years of Service
User Offline
Joined: 21st Aug 2003
Location: At home
Posted: 20th Jul 2004 22:30
I believe people were asking for an option to store in VRAM a few months ago.


Are you sensitive enough?
glint
21
Years of Service
User Offline
Joined: 9th Feb 2004
Location: the Synth
Posted: 21st Jul 2004 01:57
Thanks for the help!

Wouldn't mipmaps be stored in video memory?
bitJericho
22
Years of Service
User Offline
Joined: 9th Oct 2002
Location: United States
Posted: 21st Jul 2004 02:36
pff, i guess i was way off on that one

The Unofficial DarkBASIC Magazine : http://www.dbspot.com/j2dstudios/
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 21st Jul 2004 02:42
Quote: "Wouldn't mipmaps be stored in video memory?"


I would have assumed so, and it may actually be the case on other graphics cards.

You can see for yourself. Run this code and see which number drops:



*** Coming soon - Network Plug-in - Check my site for info ***
For free Plug-ins, source and the Interface library for Visual C++ 6, .NET and now for Dev-C++ http://www.matrix1.demon.co.uk
MiR
21
Years of Service
User Offline
Joined: 13th Jul 2003
Location: Spain
Posted: 21st Jul 2004 03:02
IanM: Your code causes the compiler to hang. How come?


Libera tu mente y te liberaras.
glint
21
Years of Service
User Offline
Joined: 9th Feb 2004
Location: the Synth
Posted: 21st Jul 2004 03:15
I ran the code and it was "smem" that decreased. What is smem? Is it RAM?
OSX Using Happy Dude
21
Years of Service
User Offline
Joined: 21st Aug 2003
Location: At home
Posted: 21st Jul 2004 03:21 Edited at: 21st Jul 2004 03:22
System Memory - possibly includes the swap file too.

Quote: "IanM: Your code causes the compiler to hang. How come?
"

Are you using 5.5?


Are you sensitive enough?
MiR
21
Years of Service
User Offline
Joined: 13th Jul 2003
Location: Spain
Posted: 21st Jul 2004 03:55 Edited at: 21st Jul 2004 03:56
Yep. Aswell as Directx 9.0b, the latest drivers and Win xp sp1.

Edited for typos.


Libera tu mente y te liberaras.
teh game wiz
21
Years of Service
User Offline
Joined: 24th Feb 2004
Location: EWS
Posted: 21st Jul 2004 04:16
i got the same tho if you wait long time it does eventualy display the numbers

http://www.elliot-dickerson.co.uk W0000000000000000000T
MiR
21
Years of Service
User Offline
Joined: 13th Jul 2003
Location: Spain
Posted: 21st Jul 2004 04:45
You´re right. I left it running while I went to the bog and viola(how can you tell I flunct French)


Libera tu mente y te liberaras.
glint
21
Years of Service
User Offline
Joined: 9th Feb 2004
Location: the Synth
Posted: 22nd Jul 2004 03:42
What is the swap file?
OSX Using Happy Dude
21
Years of Service
User Offline
Joined: 21st Aug 2003
Location: At home
Posted: 22nd Jul 2004 04:49 Edited at: 22nd Jul 2004 04:53
A swap file (or swap space or, in Windows NT, a pagefile) is a space on a hard disk used as the virtual memory extension of a computer's real memory (RAM). Having a swap file allows your computer's operating system to pretend that you have more RAM than you actually do. The least recently used files in RAM can be "swapped out" to your hard disk until they are needed later so that new files can be "swapped in" to RAM. In larger operating systems (such as IBM's OS/390), the units that are moved are called pages and the swapping is called paging.
One advantage of a swap file is that it can be organized as a single contiguous space so that fewer I/O operations are required to read or write a complete file.

In general, Windows and Unix-based operating systems provide a default swap file of a certain size that the user or a system administrator can usually change.


I came, I saw and I forgot all about it... or something...
glint
21
Years of Service
User Offline
Joined: 9th Feb 2004
Location: the Synth
Posted: 23rd Jul 2004 03:17
Are there Darkbasic commands to handle the swap file? I didn't see any in the manual. I wouldn't want any important data to be transferred to the hard disk without my knowing it in case I needed it in a hurry. I've heard that running with memory straight from the hard drive can be very slow.
OSX Using Happy Dude
21
Years of Service
User Offline
Joined: 21st Aug 2003
Location: At home
Posted: 23rd Jul 2004 09:21
Quote: "Are there Darkbasic commands to handle the swap file? I didn't see any in the manual"

No because there is nothing useful to handle.

Quote: "I wouldn't want any important data to be transferred to the hard disk without my knowing it in case I needed it in a hurry"

It may or may not happen - its up to the OS and how many running programs there are. You cant really force anything to stay in memory.

Quote: "I've heard that running with memory straight from the hard drive can be very slow. "

Accessing swap file memory is slow...


I came, I saw and I forgot all about it... or something...
MSon
20
Years of Service
User Offline
Joined: 13th Jul 2004
Location: Earth, (I Think).
Posted: 23rd Jul 2004 12:58 Edited at: 23rd Jul 2004 13:01
In my programme the memory always overflows to the paging file, and its NOT because I have to little memory, it would be much better if there were some way to access it (like via a DLL)...

My programme would run much faster...
OSX Using Happy Dude
21
Years of Service
User Offline
Joined: 21st Aug 2003
Location: At home
Posted: 23rd Jul 2004 17:02
Windows will always use the swap file even if you have plenty of memory - the only time it wont is if you manually disable it.


I came, I saw and I forgot all about it... or something...
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 24th Jul 2004 04:45
That is *not* something you should do.

Windows only pages stuff out to the swap area if it needs space for something else. It tries to page out stuff that has not been used for a while.

The only time it will page out something that you are using is when there is not enough physical memory to hold everything that is needed at once. That usually means you should close some programs, or buy some extra memory.

*** Coming soon - Network Plug-in - Check my site for info ***
For free Plug-ins, source and the Interface library for Visual C++ 6, .NET and now for Dev-C++ http://www.matrix1.demon.co.uk

Login to post a reply

Server time is: 2025-06-01 09:25:34
Your offset time is: 2025-06-01 09:25:34