Results 1 to 6 of 6
  1. #1
    2 Star Lounger
    Join Date
    Nov 2001
    Location
    London, UK, England
    Posts
    116
    Thanks
    0
    Thanked 0 Times in 0 Posts

    VB6 (Modules In Memory)

    I'm just looking for some documentation/advice on how VB handles standard .bas modules. When you call a procedure in a module, is the whole module loaded into memory for the duration of the procedure before being released?

    I have a couple of modules that are quite large and I'm worried about causing 'Out of Memory' errors on the client PCs. Anyone know of some decent articles or anything on this?

    Thanks

  2. #2
    Super Moderator
    Join Date
    Dec 2000
    Location
    New York, NY
    Posts
    2,970
    Thanks
    3
    Thanked 29 Times in 27 Posts

    Re: VB6 (Modules In Memory)

    Dylan,

    Hopefully someone else can point you to a relevant article, just wanted to note that the answer to your first question is almost certainly yes.
    Do you have the option of breaking the large modules into smaller ones?

    Gary

  3. #3
    2 Star Lounger
    Join Date
    Nov 2001
    Location
    London, UK, England
    Posts
    116
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: VB6 (Modules In Memory)

    Gary,

    Yes, I think this is what I'm going to do. I was just hoping to find some articles to give a bit more info on what an 'acceptable' size module is and how they are handled during code execution - searched MSDN and found exactly nothing...!

    Thanks for your answer.

    Dylan

  4. #4
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: VB6 (Modules In Memory)

    Because Windows will use virtual memory when it wants to, I don't think you really can use up all the memory. That's not to say a smaller module wouldn't perform better, but maybe that explains why it wasn't expressly addressed?

  5. #5
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: VB6 (Modules In Memory)

    How big is "quite large"? Modules are usually broken up according to the kind of routines they contain but I doubt that your modules are large enough to cause out of memory errors on a PC. What *will* cause those errors is not unloading forms and destroying objects before ending the application.
    Charlotte

  6. #6
    2 Star Lounger
    Join Date
    Nov 2001
    Location
    London, UK, England
    Posts
    116
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: VB6 (Modules In Memory)

    I suppose the biggest module is about 100KB & that's been broken down into specific modular routines already (it's a particularly complicated application now!). Whilst this isn't much in itself, I worry about the client PC's who don't have as much RAM and pretty much push their PCs with multiple instances of Word, Access, Excel etc.

    This isn't a serious problem, it's not something thats causing the app to crash - I'm just not sure on how the modules are handled in Memory compared to say class objects which have obvious initialise/terminate events (Maybe I'll create a few more objects if possible and get some of the code out of standard modules).

    Thanks for the answers - always good advice on this site.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •