473,725 Members | 2,017 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

C#-App: High Memory Usage in Animation of image files using timer

71 New Member
HI everyone,

I hope someone can help me on this.
I have form application that has 3 Timers that does an animation (changing an image for every interval)

Each image are loaded at start of application and saved into a Dictionary<stri ng, List<Image>>

The dictionary will have 5 items which is for 5 controls.
then each control will have this images in the dictionary(I also assigned the timers):

Timer 1 (Interval:100) = 110kb / image, 25 images, 425x165
Timer 2 (Interval: 25) = 72kb / image, 81 images, 615x810
Timer 3 (Interval: 50) = 10kb / image, 25 images, 249x169

Then 3 timers will be doing the animation for those 3 Dictionary.

Currently I will just use my task manager to read the memory usage of my application.

Without loading/playing the animation image: 220MB
With loading/playing the animation image : 1.3GB

NOTE: I have found out about CLRProfiler.exe but I may need some time to study how it is used and how to benefit from it and i am also having trouble showing the data when my application run.So just used task manager as of the moment.

Hoping for your positive replies.

TIA

-dantz
Sep 16 '09 #1
6 2981
dantz
71 New Member
hmmm..I think I found my answer to my question. Seems like it is more efficient to load the file whenever they are needed rather than loading them all at start.

If I do this procedure I am having a constant usage of 580mb.

But I am still investigating on this matter.

If anyone have comments please post it still.

Thanks a lot
Sep 16 '09 #2
tlhintoq
3,525 Recognized Expert Specialist
@dantz
I don't know where you are getting those image sizes from. Common sense says that if an image of 425x165 is 110k, then a bigger image of 615x810 isn't going to be a smaller size of 72k.

425x165 @ 8 bit color = 205 kb x 25image = 5125 k = 5 meg
615x810 @ 8 bit color = 1.43 meg x 81 images = 11583 meg
249x169 @ 8 bit color = 123.3 kb x 25 images = 30825 k = 30 meg
Yep - sounds about like 1.3 gig

Keep in mind that jpg (compressed) file size on disc is not the same as uncompressed memory consumption once you load them into memory.
Sep 16 '09 #3
dantz
71 New Member
@tlhintoq
Thanks tlhintoq.
I really appreciate your reply.

I forgot to tell that these are PNG files. Im not sure if there are any difference in your computation.

The 615x810 images contains less color and drawing compared with the 425x165 images. I think that is the reason why it has a smaller size.
Sep 17 '09 #4
tlhintoq
3,525 Recognized Expert Specialist
My computation was simply by creating a new document in Photoshop of RGB at 8 bit. Each time you enter new dimensions it tells you the size of the document.

The PNG file format still employees compress when saving. A very good compression scheme.
http://www.libpng.org/pub/png/pngintro.html
So that is why the files are smaller on hard drive.

But once you load them into memory they become bitmaps, meaning no compression. So your 615x810 image is still 810 rows of 615 8-bit pixels. That's where all your memory is going.
Sep 17 '09 #5
dantz
71 New Member
oh...ic..
now I know.

Thanks for sharing the info.

I learned something there.

:-)
Sep 17 '09 #6
sword117
35 New Member
i got the same problem too.. but im loading 2003 jpg images, and it reads 3.279.108k on task manager.. if i use a background worker would it load faster? =)
Jul 23 '10 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

3
4146
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 periodically. What happens, is that the app reads the contents of a text file line by line into an ArrayList. Each element of the ArrayList is a string representing a record from the file. The ArrayList is then processed, and the arraylist goes out of...
20
4228
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 memory usage drops to a couple hundred KB. Why? Is there anything I should to to prevent this? I have compiled in release and deactivated all forms of debugging, I think! Thanks, Philip
4
2432
by: Dan K. | last post by:
Hi NG, first of all i am new to OOP and C# so maybe thats my whole problem :) i wrote a small timer application, like i did if i was starting with programming in vb long time ago. the vb application (few years old) has memory usage around 7.000 K ... my new written C# Application around 18.000 K. after few operations like minimize to tray and then reactivate form memory usage rises higher ... i tried to integrate things like...
4
3668
by: Brad Markisohn | last post by:
I want to be notified when a PnP device is added or removed. To accomplish this task, I added two occurrences of a System.Management.ManagementEventWatcher. I've included a snippet of code that is called when the user pushes a button to start listening. Using the Windows Task manager I can monitor the CPU usage. When the watchers are active, the CPU usage spikes to 100%. Turning of the watchers reduces the CPU usage back to it's...
7
5511
by: Erkan Tatlidil | last post by:
Hi, Our customer has a win2k Xeon 2.0 web server with 2GB of Ram. After a certain time the aspnet_wp.exe consumes %70 of the Ram and comes to a standstill. We end the process and everything is ok. We used memory profiler to find out what is causing the problem but couldn't come to a result. I've noticed that their is a patch for this type of cause on Microsoft's web site but no download. The framework is 1.1.4322
0
1085
by: Dinesh | last post by:
Hi, We are seeing high memory usage (1GB) and subsequently out of memory exception. We are trying to transform the documents using xslt and most importantly using Assembly.Evidence to avoid security exception. Is there any known issue with Assembly.Evidence and memory usage. Please help
2
2023
by: Colin McKinnon | last post by:
Hi all, I am currently working on a project which involves using a lot of code on each page. I'm currently refactoring with a view to performance and have discovered that when my app starts to include the class definitions it needs, the memory gets eaten up *very* rapidly - indeed, typically, the memory usage is TEN TIMES the size the class file occupied on the disk - note this memory usage is only as a result of require_once() not...
0
8888
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8752
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9257
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9111
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6702
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6011
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4517
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3221
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2634
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.