473,396 Members | 1,872 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Memory usage.

I have a program that generates a custom bimap every 50ms. Which is slow, but no way to make it faster.
Now I want to keep it generating as fast as possible (which is 50 ms).
But I have to store these images somewhere.
The only place I can think of is ram.
What effect would so many bitmaps have on memory usage (maybe tens of thousands).
Im imagining it memory usage would be unaccaptable. Am I wrong?
How big is one bitmap object in memory?
Would it make a difference if I use an Image object?

Any help is greatly appreciated.
Thank you.
Nick Z.
Nov 16 '05 #1
4 1885
Nick <pa*****@optonline.net> wrote:
I have a program that generates a custom bimap every 50ms. Which is
slow, but no way to make it faster.
Now I want to keep it generating as fast as possible (which is 50
ms).
But I have to store these images somewhere.
The only place I can think of is ram.


Why not store them on disk? If you have one thread creating bitmaps and
one thread writing them to disk, with a queue between them, I wouldn't
have thought you'd have too many problems.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 16 '05 #2
Jon Skeet [C# MVP] wrote:
Nick <pa*****@optonline.net> wrote:
I have a program that generates a custom bimap every 50ms. Which is
slow, but no way to make it faster.
Now I want to keep it generating as fast as possible (which is 50
ms).
But I have to store these images somewhere.
The only place I can think of is ram.

Why not store them on disk? If you have one thread creating bitmaps and
one thread writing them to disk, with a queue between them, I wouldn't
have thought you'd have too many problems.


Well I thought it would take too long.
Could you please explain what you mean by using two threads and a queue between them?
Two programs running? Or do you mean hyper threading? Im no pro as you can tell.

Thank you.
Nick Z.
Nov 16 '05 #3
Nick <pa*****@optonline.net> wrote:
Why not store them on disk? If you have one thread creating bitmaps and
one thread writing them to disk, with a queue between them, I wouldn't
have thought you'd have too many problems.


Well I thought it would take too long.
Could you please explain what you mean by using two threads and a
queue between them?
Two programs running? Or do you mean hyper threading? Im no pro as
you can tell.


I mean just two threads in the same process. See
http://www.pobox.com/~skeet/csharp/multithreading.html

You'd want to use two threads so that one would be doing the IO while
the other was generating the images themselves. You might want to limit
the size of the queue so that if the generation thread got too far
ahead, you could just wait for the IO thread to catch up a bit rather
than keeping on generating and potentially running out of memory.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 16 '05 #4
"Nick" <pa*****@optonline.net> wrote in
news:Y6*********************@news4.srv.hcvlny.cv.n et...
I have a program that generates a custom bimap every 50ms. Which is slow, but no way to make it faster. Now I want to keep it generating as fast as possible (which is 50 ms).
But I have to store these images somewhere.

How big are these bitmaps, and how many are there going to be? If they can
be created in 50 ms, why do you have to store them at all, and not create
them on demand?
The only place I can think of is ram.
The harddrive is another place; But that depends on your images' sizes;
Writing big consecutive blocks on a defragmented medium is pretty fast.
What effect would so many bitmaps have on memory usage (maybe tens of thousands).

Not sure if I got that question right... Of course they will *consume*
memory. And it's limited. But I think you already knew that.
Im imagining it memory usage would be unaccaptable. Am I wrong?
How big is one bitmap object in memory?
This all depends on the size of your images.
If you had to store 640x480x24 images, one uncompressed image would take
roughly 1MB (640 * 480 * 3), so you won't be able to store more than a few
hundred of them in memory.

I think if the images are about 320x240 or smaller you can effectively
compress them to an MPEG stream and save that to disc (Lossy compression).
Would it make a difference if I use an Image object?


System.Drawing.Image is abstract; You can't create objects of it.

Niki
Nov 16 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: rbt | last post by:
Would a Python process consume more memory on a PC with lots of memory? For example, say I have the same Python script running on two WinXP computers that both have Python 2.4.0. One computer has...
5
by: Justice | last post by:
Currently I'm doing some experimenting with the XMLHTTP object in Javascript. Now, the XMLHttp object is asynchronous (at least in this case), and the following code causes a significant memory...
2
by: tomvr | last post by:
Hello I have noticed some 'weird' memory usage in a vb.net windows app The situation is as follows I have an app (heavy on images) with 2 forms (actually there are more forms and on starting...
6
by: Tom | last post by:
We have a VERY simple .NET C# Form Application, that has about a 23MB Memory Footprint. It starts a window runs a process and does a regular expression. I have done a GC.Collect to make sure that,...
2
by: Jarvis | last post by:
I've made a testing program to test the memory usage of some Data Forms. I create a MDI parent form with one single MDI child form, which is a Data Form generated by .NET Data Form Wizard. To...
3
by: Ian Taite | last post by:
Hello, I'm exploring why one of my C# .NET apps has "high" memory usage, and whether I can reduce the memory usage. I have an app that wakes up and processes text files into a database...
20
by: Philip Carnstam | last post by:
How come .Net applications use so much memory? Every application I compile uses at least 10 MB of memory, even the ones consisting of only a form and nothing else. If I minimize them though the...
13
by: Ilias Lazaridis | last post by:
How to detect memory leaks of python programms, which run in an environment like this: * Suse Linux 9.3 * Apache * mod_python The problem occoured after some updates on the infrastructure....
1
by: yzghan | last post by:
Hi all, I feel that my python script is leaking memory. And this is a test I have: log.write(" " + "test() ... memory usage: " + " ".join(repr(i/(1024*1024)) for i in getMemInfo()) + "\n") m...
1
by: Jean-Paul Calderone | last post by:
On Tue, 22 Apr 2008 14:54:37 -0700 (PDT), yzghan@gmail.com wrote: The test doesn't demonstrate any leaks. It does demonstrate that memory usage can remain at or near peak memory usage even after...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.