?
Solved

What is Taking Up So Many Resources?

Posted on 2005-04-21
6
Medium Priority
?
236 Views
Last Modified: 2011-08-18
Hi,

My program, a quite simple program, uses so many resources it's incredible. And it varies a lot, sometimes it takes about 15,000 K, sometimes it reports 25,000K in the task manager. Why is this? All I use is simple variables, a couple of arrays with like 10,000 entries.., a few BMP's including one that's 150 x 150, no big deal!...

I know it would be easier if you could see the code but let's just make it a general question then. What, in general, does take a lot of system resources? I have many hytpothesis but no clue:

- graphics?
- arrays?
- variants instead of fixed type variables?
- ongoing processes like Timers (I have like 8 firing every second, could this be that?)

Please don't tell me the usual stuff like "using an image object takes up less resources than a picture object", I know that. Or don't answer "all of these things take up resources". I know that. I know that using variant is not as good as fixed type varialbles, but what I really need to know is what, in general, TAKES THE MOST RESOURCES so I know where to look first... what to fix prioritarily.

Thanks a ton,

Gizmo





0
Comment
Question by:GizmoBlaster
6 Comments
 
LVL 23

Accepted Solution

by:
gecko_au2003 earned 50 total points
ID: 13835120
I would have to say from what you have explained the Timers ( the on going processes ) would take up the most resources. Have you got any loops within the timers ie for ... next, do until, etc ?

You said you have a few graphics so I would put that as last in the list of things that take up the most resources, unless your defintion of a few is like a few hundred or a few thousand or something to that extent then obviously that would mean it would take up more resources ( obviously ).

Other then that I would look at the arrays as you said you had aprox 10,000 or so and also using fixed typed variables.

I am not really sure other then that what kind of an answer you were hoping for !!

If this is not sufficient please let us know :)
0
 
LVL 29

Assisted Solution

by:nffvrxqgrcfqvvc
nffvrxqgrcfqvvc earned 100 total points
ID: 13835890
I don't think its the timers at all, it might be the code you have inside the timers but the timers alone are great for  keeping low system resources.

If you have loops in your timers make sure you exit the loops and add Doevents to let the system catch up.

Please post the code you have inside the timers.
0
 
LVL 1

Assisted Solution

by:mushu999
mushu999 earned 100 total points
ID: 13835954
What is your definition of "resources"? Do you mean memory? Or CPU processor power? Or generated page faults? What does Task Manager say while your program is running, first upon startup, then after a few minutes? Is this in the VB IDE or after you have compiled your project? Are you compiling to native code or to p-code? P-code is much smaller on disk, but generally runs a bit slower due to lack of optimizations (among other things).

We need more info before we can give you a solid answer.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:GizmoBlaster
ID: 13836683
When I talked about arrays of 10,000, I meant I have 2-3 arrays with dimensioned for 10,000 entries but they are not used up. mostly 100 entries per array most of the time. short text entries I mean.

by resources, I meant memory. Just found out that it only doubles when my app invokes windows media object, then it passes from approx 13,000 K to 25-30,000K... So that partly answer my question. But still, 13,000K seems a lot for a simple app, how come my app is requesting so much memory from windows? What kind of thing lock in memory from windows like that? That's what I don't understand.

Gizmo
0
 
LVL 29

Assisted Solution

by:nffvrxqgrcfqvvc
nffvrxqgrcfqvvc earned 100 total points
ID: 13836914
If you post your code so everyone can look at it, it might help.  Try disabling each timer 1 by 1 and check to see if the memory goes down at all, if it goes down by alot then I would overlook the code in that timer.

Without posting your code it's really a guessing game.
0
 
LVL 1

Assisted Solution

by:mushu999
mushu999 earned 100 total points
ID: 13837072
Agreed. It is a guessing game. Remember, every variable type takes up a different amount of memory, with variants taking a whopping 8 bytes per element in an array, plus overhead. This is from memory, but I think that's accurate. So, again, without code I can only guess, but you might not be specifying a type with your array dimensions, which means the default type is Variant. If you don't need that many, try using ReDim Preserve array_name(# of elements) to cut down on allocated memory. This is a slow process (relatively speaking) so you won't want to do it all the time, say in a loop...memory moves are very expensive in VB (and in ASP too).
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question