• VB6 (Modules In Memory)

    Author
    Topic
    #374225

    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

    Viewing 1 reply thread
    Author
    Replies
    • #604779

      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

      • #604906

        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

        • #605114

          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?

    • #605169

      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.

      • #605176

        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.

    Viewing 1 reply thread
    Reply To: VB6 (Modules In Memory)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: