• 0

Why does VB apps use so much memory?


Question

16 answers to this question

Recommended Posts

  • 0

The answer to query lies in the fact that VB6 is an interpreted language whereas what you're expecing is a compiled language. (If you need to know the difference, then Google it).

VB6 is generally regarded as a memory hog compared to solutions for same problems when comapred to C or C++ programs.

Parimal

  • 0

I write all my software using VB6, and it's most likely that it's because the VB6 runtimes are attached to each program you write. This is why there's an extra 3MB or so to your app. But like hash said, memory is cheap these days, and who cares if it's 3mb or 500kb.

  • 0
  parimal_kumar said:
The answer to query lies in the fact that VB6 is an interpreted language whereas what you're expecing is a compiled language. (If you need to know the difference, then Google it).

VB6 is generally regarded as a memory hog compared to solutions for same problems when comapred to C or C++ programs.

Parimal

I thought that VB6 was a compiled language. :huh: :unsure:

  • 0

Change the compiler mode... "P-Code" and "Native Code", I don't remember which one is default, try both.

Programs programmed in assembly language uses the smallest amount of memory, Windows allocates memory for the program and if the program needs more then the program must call external functions that the assembler doesn't put there itself.

  • 0
  parimal_kumar said:
Nope! VB 6 is most definitely interpreted. That's why it's deemed slower than its compiled counterparts such as VC++

Parimal

Wrong. VB 6 defaults to compiling to a native binary. You have to go in and change the setting to get PCode. It's been that way since VB 5.

  • 0

It still heavily depends on several system libraries, such as MSVBVM*0.DLL or something like that.

You can see the list of exports that DLL provides, and it doesn't matter wich way you compiled your program (p-code or native), it still requires many many many functions from it.

  • 0

Yes, vb6 is compiled. No, the runtimes are not included in the exe. The reason for high memory usage is similar to why .net uses so much; if your system begins to run out of ram, less is allocated to the vb6 app. If it really bothers you, use the SetProcessWorkingSetSize API and lower the mem usage that way.

  • 0
  Latka said:
It still heavily depends on several system libraries, such as MSVBVM*0.DLL or something like that.

You can see the list of exports that DLL provides, and it doesn't matter wich way you compiled your program (p-code or native), it still requires many many many functions from it.

VC++ has its own libraries as well, such as msvcrt.dll.. so comparing required runtimes to memory usage doesnt really work

  • 0
  hash said:
VC++ has its own libraries as well, such as msvcrt.dll.. so comparing required runtimes to memory usage doesnt really work

Well no, you can't "compare" the memory requirement to the runtime, because the VC runtime libraries don't do the same things that the VB runtimes do; they're really not even the same thing. The VC runtimes are Win32 DLLs that a VC++ application calls to get work done; the VB runtimes are COM libraries.

That's actually the source of the extra memory requirement (to answer the original question). VB programs aren't actually programs by themselves; they rely on COM.

  • 0

ok....heres the DEFINITIVE answer to ur question:

like everyone else so far has told you, yes VB6 DOES require certain runtime files. These runtime files are loaded in the memory even before YOUR app starts, and even before your first line of code is executed, or your first form pops up. When you goto the VB6 package and deployment wizard it includeds these runtime files in your distribution, so that when you give your program to your friends, who might not have these runtime files, it will install them on their PC.

is this really bad? well, yes and no. from a purely technical standpoint, this tells you that yeh, VB6 is inefficient compared to other languages like C++ or C. It imposes a significant overhead (roughly 2-3 MB), which might make your small apps, and nifty tools that you program in VB seem quite ugly, compared to what they could have been if made in VC++.

However from a more realistic viewpoint, it hardly matters. Firstly because like everyone said, 2-3 MB in todays world is hardly a problem. With systems having 512+ MB, im sure everyone can spare a little extra. Secondly, this overhead of 2-3 MB remains constant no matter how large YOUR application is. So wheather you make a 1 form app, or a MONSTER containing 200 forms, and a couple of thousand lines of code, the EXTRA amount taken will remain 2-3 MB for the dll files, and you will notice that the memory occupied doesn't increase so sharply as the size of your app grows.

Hope this helps

danish

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Posts

    • Meta (Facebook) tends to make horribly designed apps, which not sure if its deliberate or just plain poor design, maybe due to incompetence. For a huge internationally and well known company, this is baffling, they are getting bad PR but I guess they are tok big and super popular and seemingly can get away from any gov thus they are getting away with these blunders. Example their Facebook Stories, when mobile OS uses gestures for years to go back to previous menu, it just tends to swipe to previous or next stories instead of exiting the UI. I have to make sure I swipe from the very edge. This really bad UX but Facebook doesnt car about the bad UI practices. Is this deliberate, malice? Idk, maybe for force engagement, or just somebody never tested their products well about the issue, maybe they think user should know better and just arrogant to thing we are using it wrong?
    • This is insane for a tech focused site tbh. I cant understand anyone who would want this let alone anyone interested in tech or pc's. I understand the want to push stack deals but this is a terrible deal. I have bought a few deals through neowins stack before, they were good deals but this....
    • Its really apparent that these features and how they treat new Outlook now to be only web based to call these features "Offline mode". Like before we just gain features without them being called offline mode feature, but now here it is. It feels like if these codes bugged, we might left with app that is just useless liece kf codes when PC isnt connected to internet, especially laptops and tablets/convertibles.
    • Amazon Deal: Sony 65 inch 4K Bravia 5 2025 Mini LED TV with Dolby Vision/Atmos is $200 off by Sayan Sen Recently, we covered soundbar home theatre deals from Samsung and JBL for under $1000. Those are still selling for their best prices and you can check them out in their respective articles linked above. Obviously, for a home theatre, you also need a display, and depending on the kind of setup and room you have, you could choose a fairly premium projector like Valerion's StreamMaster Plus2 4K that is currently $300 off on Amazon US, or you could look for a TV. If you are looking for something for under $1500 then Sony has a great deal at the moment. The company's Bravia 5 mini LED 65-inch TV is on sale for $1298 thanks to a $200 discount (purchase link under the specs list below). Mini LEDs, unlike LEDs, promise much better precision in terms of backlighting which should lead to better contrasts with deeper blacks and brighter whites without being overblown either way. The full specs of the Bravia 5 are given below: Display Resolution: 3840 x 2160 (4K UHD) Panel Type: LCD with Mini LED backlight Backlight Dimming: XR Backlight Master Drive with local dimming for enhanced contrast Panel Refresh Rate: 120 Hz HDR Compatibility: Supports HDR10, HLG, and Dolby Vision Color & Image Processing: XR Triluminos Pro™ with Live Color™ technology, XR Clear Image, and XR Motion Clarity™ Connectivity & Ports: HDMI Inputs: 4 side-mounted (supports HDMI 2.1 features including 4K at 120Hz, eARC, VRR, ALLM, and SBTM) HDCP: Version 2.3 on all HDMI ports USB Ports: 2 side ports (supports FAT16, FAT32, exFAT, and NTFS formats) Other Ports: RS-232C Input: 1 (side) Digital Audio Output: 1 (side) RF (Terrestrial/Cable) Input: 1 (side) LAN Input: 1 (side) Wireless & Smart Features: Wi‑Fi: Dual‑band (2.4 GHz/5 GHz) with support for Wi‑Fi Certified 802.11 and Wi‑Fi 6 Bluetooth: Version 5.3 (compatible with A2DP, HID, HOGP, SPP, and AVRCP) Built‑in Chromecast: Yes Operating Platform: Google TV Smart Connectivity: Features BRAVIA Sync (with HDMI‑CEC), Apple HomeKit, and Apple AirPlay Get it at the link below: Sony BRAVIA 5 65 Inch TV, Mini LED, 4K120hz Television with Dolby Vision/Atmos, Exclusive Features for PlayStation®5, K-65XR50, 2025 Model: $1298.00 (Shipped and Sold by Amazon US) This Amazon deal is US-specific and not available in other regions unless specified. If you don't like it or want to look at more options, check out the Amazon US deals page here. Get Prime (SNAP), Prime Video, Audible Plus or Kindle / Music Unlimited. Free for 30 days. As an Amazon Associate, we earn from qualifying purchases.
  • Recent Achievements

    • Explorer
      Case_f went up a rank
      Explorer
    • Conversation Starter
      Jamie Smith earned a badge
      Conversation Starter
    • First Post
      NeoToad777 earned a badge
      First Post
    • Week One Done
      JoeV earned a badge
      Week One Done
    • One Month Later
      VAT Services in UAE earned a badge
      One Month Later
  • Popular Contributors

    1. 1
      +primortal
      523
    2. 2
      ATLien_0
      231
    3. 3
      +FloatingFatMan
      150
    4. 4
      +Edouard
      142
    5. 5
      Michael Scrip
      109
  • Tell a friend

    Love Neowin? Tell a friend!