|
-
Apr 2nd, 2002, 11:48 AM
#1
Thread Starter
Frenzied Member
Why oh why do vb apps use so much ram?!
I have a form, borderstyle set to none, dimensions 5 pixels by 5, visiible = false, and it STILL uses 2mb+ of ram..
how can you get it to use less ram? for example, if i want no form at all, just an icon in the tray which will contain code, how can i do this?
-
Apr 2nd, 2002, 11:50 AM
#2
I guess becuase it is loading the vb runtime into memory also.
-
Apr 2nd, 2002, 11:53 AM
#3
Frenzied Member
to have no form, just put your code in your main in a module!
-
Apr 2nd, 2002, 11:57 AM
#4
Black Cat
VB uses COM, which needs to allocate space for itself. In my experience, initializing COM in a simple C++ app causes about 1.5 - 2 MB of extra RAM to used.
Josh
Get these: Mozilla Opera OpenBSD
I have books for sale: "MCSD in a Nutshell" and "VB Distributed Exam Cram" - PM me for details. Will also trade for a decent ATX Pentium 2 MB/CPU/RAM combo.
-
Apr 2nd, 2002, 08:05 PM
#5
Thread Starter
Frenzied Member
when i added a module, removed the form, and used a module with submain and the code "msgbox test" - and this used 3.5 megs of ram. then i set it to do nothing.. and it used 2mb+ of ram in the fraction of a second it was open..
arrgh how can you stop it from using so much ram?!
-
Apr 2nd, 2002, 08:13 PM
#6
PowerPoster
What kind of computer are you running this program on that 2mb of ram is a lot?!!? Even when I had windows 3.1, I still ran with 64mb of ram, and 2 mb isn't much out of 64. Most people have 128 or 192 now-a-days.
-
Apr 2nd, 2002, 08:29 PM
#7
Thread Starter
Frenzied Member
still.. i saw a MUCH better trayer program than the one i had created (the one to add apps to the tray) which was written in c++, took up 127k of ram and was using subclassing and everything.. i just want to know how i can build a vb app which does something like that and take <1 meg of ram to accomplish..
-
Apr 2nd, 2002, 08:32 PM
#8
PowerPoster
It's gotta be something to do with the VB runtimes or the way VB works. 2 MB sounds like the minimum amount of memory a VB program will use.
-
Apr 2nd, 2002, 08:34 PM
#9
PowerPoster
I just looked and I have a program called CounterAmp that I made in VB, but I didn't use any controls, it is all drawn with code, and it only takes 1.7mb of RAM. That's still a lot, but compared to programs like internet explorer that take 10+ megs, it's not that much.
-
Apr 2nd, 2002, 08:42 PM
#10
Are you running it in the IDE? If so your running with p-code.
Did you compile to native code, or p-code? If you compile to p-code, the runtime is most definitely loaded because it acts as a interpreter. Native code is usually a little better in the ram department because it uses the runtime as a "true" dll file, not as an interpreter also.
I can't give you numbers, as i am not on a VB enabled machine right now. Try compiling it to native code, and running it outside of the ide, see if that improves performance.
-
Apr 2nd, 2002, 08:53 PM
#11
I didn't read the other posts - mea culpa.
But - did you know that VB runs inside a virtual machine, just like java? The virtual machine takes up RAM, even with a zero size program (if there could be such a thing).
Every form, every control, every object you reference requires that the OS map memory into your process space to handle it.
You put 20 textboxes on a form and watch it crash....
-
Apr 3rd, 2002, 02:00 PM
#12
Black Cat
Does native code run in a VM, or just P-code? I was under the impression that native code calls functions from the vb runtime dll like like any Win32 program would call functions from any standard dll.
Josh
Get these: Mozilla Opera OpenBSD
I have books for sale: "MCSD in a Nutshell" and "VB Distributed Exam Cram" - PM me for details. Will also trade for a decent ATX Pentium 2 MB/CPU/RAM combo.
-
Apr 3rd, 2002, 09:02 PM
#13
Josh T,
Look at my earlier reply in this thread....or.....the short answer, you have it right....
-
Apr 4th, 2002, 02:44 AM
#14
Also, turning off the option 'incremental building' can save alot of space.
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
|