|
-
Nov 16th, 2000, 10:35 PM
#1
Thread Starter
Frenzied Member
Hi. I am just wondering if some of you experienced programmers could leave some general tips on how to reduce the amount of memory an application uses. Some of my programs use way too much memory and I even got an 'out of memory' error today when unloading the application.
Thanks
Wengang
Wen Gang, Programmer
VB6, QB, HTML, ASP, VBScript, Visual C++, Java
-
Nov 16th, 2000, 10:46 PM
#2
transcendental analytic
1. Try to avoid Controls and objects as much as possible, use UDT's instead of classmodules.
2. Don't have unnessesary variables, Use arrays instead of collections, Erase or optimize arrays that you don't need/have items you don't need
3. Don't use End, don't declare objects in standard modules without unloading them before termination
4. Don't terminate your app! That means don't click the stop button on vb toolbar
5. Be careful and delete all objects and device context when youre dealing with api's
6. Have resource meter loaded, and watch what's causing the resource loss.
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Nov 17th, 2000, 12:48 AM
#3
Thread Starter
Frenzied Member
Thanks Kedaman
Question:
If I declare a variable array like this
dim strVariable(10000) as string
Does that set aside memory for 10001 variables right away,
or just one, or does it set aside memory only as they are
assigned values?
And if that is the case (the first one), when you are coding, do you regularly use any method of releasing the memory space of the unassigned strings?
Thanks again.
Wen Gang, Programmer
VB6, QB, HTML, ASP, VBScript, Visual C++, Java
-
Nov 17th, 2000, 12:57 AM
#4
transcendental analytic
the array will take up 24 bytes + the cumulative string lengths*2 + 22*10000 bytes
declare the array dynamic and you'll be able to erase it with erase statement =
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Nov 17th, 2000, 03:56 AM
#5
Addicted Member
What's a UDT?
This may sound stupid to you, but what is a UDT? User Defined Type?
Regards,
Laurens
Using VB5 Enterprise edition SP3
VB6 Enterprise edition SP5
-
Nov 17th, 2000, 04:42 AM
#6
Frenzied Member
Jop - validweb.nl
Alcohol doesn't solve any problems, but then again, neither does milk.
-
Nov 17th, 2000, 09:55 AM
#7
Hyperactive Member
Kedaman,
You said "Have resource meter loaded...".
What is that and where can I get it from?
Thanks.
-
Nov 17th, 2000, 10:41 AM
#8
New Member
Resource meter means the application which gives u all the details 'bout ur system dynamically. Like memory usage currently, cpu usage.
U can find this option under ur program- accessories- system tools option under win9x for WinNT, u have to just press Cltr + Alt + Del and go to performance tag.
Thats it.
Cheers
Latesh
-
Nov 19th, 2000, 02:23 PM
#9
transcendental analytic
Sorry, i was away this weekend and that last post was posted 2 mintues before my bus. Yep Resource meter should be at
C:\WINDOWS\RSRCMTR.EXE
but it only shows System, GDI and User Resources, but that's the ones you need to keep looking at while your running your app.
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|