Re: Is There a Way to Remove a Module From Memory"

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance




"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


.



Relevant Pages

  • Re: Efficient python 2-d arrays?
    ... covered so there's not really a lot of demand for it. ... are loading 1.5 GB arrays into memory, ...
    (comp.lang.python)
  • Re: Strange Behavior
    ... Our application loads many DLLs into memory. ... but after loading them the overall speed of the ...
    (microsoft.public.dotnet.framework.performance)
  • Loading XP from disk?
    ... If you start the Windows XP disk, it loads to an option page ... Does "installing" XP mean just loading the program from disk ... to memory for current session use, ...
    (microsoft.public.windowsxp.general)
  • Re: [Lhms-devel] [PATCH 0/7] Fragmentation Avoidance V19
    ... > I am not enough of a kernel level person or sysadmin to know for certain, ... And when you don't use it, we'd be able to use those zones for at least ... Now, for many loads, that's fine. ... are often a big part of the memory use. ...
    (Linux-Kernel)
  • Re: Enterprise Library 3.1 - slow?
    ... Loading the class without the call to the database object simply loads ... My Config file is as follows: ... Post your .config file connection string information so the ...
    (microsoft.public.dotnet.languages.csharp)