Re: Is There a Way to Remove a Module From Memory"
- From: "Larry Serflaten" <serflaten@xxxxxxxxxxxxxx>
- Date: Sun, 3 Jun 2007 16:23:37 -0500
"Steve Gerrard" <mynamehere@xxxxxxxxxxx> wrote
My understanding is that, assuming all code has been compiled to .exe or .dll,
at startup the executable will be loaded into memory.
Trying to find relavent material is getting harder and harder due to everything
switching over to .Net, but there is this:
http://msdn2.microsoft.com/en-us/library/253b8k2c(VS.80).aspx
Like the rest of a program's code, DLL code is mapped into the address space
of the process when the process starts up and it is loaded into memory only
when needed. As a result, the PRELOAD and LOADONCALL code attributes used
by .def files to control loading in previous versions of Windows no longer have meaning.
As it says, "Like the rest of a program's code..." which would mean the entire
program's modules are loaded on demand.
The level of management however is exe or dll, not whatever break down happened
to be in the source code, so speaking about "loading a .bas module" doesn't
really make sense. Note that when discussing loading of code, the term module is
often used to refer to an exe or dll.
That is not how I understood it. How would VB support compile on demand if
the whole program had to be loaded when it started up?
http://msdn2.microsoft.com/en-us/library/aa241763(VS.60).aspx
The default in Visual Basic is to compile code on demand. This means that there
may be code in your component which is not compiled until the client calls it.
AHA! I found the page I had seen before:
http://msdn2.microsoft.com/en-us/library/aa716325(VS.60).aspx
Visual Basic loads modules on demand ? that is, it loads a module into memory only when
your code calls one of the procedures in that module. If you never call a procedure in a
particular module, Visual Basic never loads that module. Placing related procedures in the
same module causes Visual Basic to load modules only as needed.
To be fair, the only time I have ever put this to use is when supplying a Sub Main
that would test weather the program should run or not, or had a splash screen
to show before loading the main form. Putting the Sub Main in a module by itself
mattered little to the rest of the program, but it would mean only that little bit of
code would be loaded to do the testing, or direct the start up process. In other
words, it would respond faster because there was less to load than having to load
rather than some huge code module just to inform the user another instance is
already running or other such details.
HTH
LFS
.
- Follow-Ups:
- Re: Is There a Way to Remove a Module From Memory"
- From: Kevin Provance
- Re: Is There a Way to Remove a Module From Memory"
- From: Steve Gerrard
- Re: Is There a Way to Remove a Module From Memory"
- References:
- Re: Is There a Way to Remove a Module From Memory"
- From: Ralph
- Re: Is There a Way to Remove a Module From Memory"
- From: Larry Serflaten
- Re: Is There a Way to Remove a Module From Memory"
- From: Steve Gerrard
- Re: Is There a Way to Remove a Module From Memory"
- Prev by Date: Re: VB project went read only?
- Next by Date: Re: Is There a Way to Remove a Module From Memory"
- Previous by thread: Re: Is There a Way to Remove a Module From Memory"
- Next by thread: Re: Is There a Way to Remove a Module From Memory"
- Index(es):
Relevant Pages
|