Compile causes file size bloat

  • Thread starter Thread starter Anand
  • Start date Start date
A

Anand

Hello,
Am using A2k on a Windows Vista machine. Every time I compile the
application the file size bloats by 2 to 3 MB. Is there any reason for this?
Any way to avoid?

Also, are there any known performance and compatibility issues with A2k in
Vista/XP operating systems?

TIA
Anand
 
An MDB contains 2 copies of the code:
a) the text version (what you see and edit);
b) the compiled version (what actually executes.)

When you compile and save, (b) becomes part of the file. It it therefore no
surprise if the file size increases when the compiled code is saved. It will
be more efficient to execute (as it is pre-compiled, ready to run.)

Access 2000 works fine on Vista or XP. If you strike any problems, post a
query about it. Here's a general Performance FAQ for Access from Tony Toews:
http://www.granite.ab.ca/access/performancefaq.htm
 
An MDB contains 2 copies of the code:
a) the text version (what you see and edit);
b) the compiled version (what actually executes.)

When you compile and save, (b) becomes part of the file. It it
therefore no surprise if the file size increases when the compiled
code is saved. It will be more efficient to execute (as it is
pre-compiled, ready to run.)

The code is going to compile whether you tell it to or not, at least
if the code is being called when your app is used. But if you let
Access compile on demand, it will be much less efficient
compilation, and much more subject to corruption.

You should compile regularly while programming, and periodically
decompile/compact/recompile. And you should turn off COMPILE ON
DEMAND in the VBE.
 
Thanks to both Allen and David for the inputs. I apologise for not responding
earlier since was away from Internet for few days.

I have two more questions relating to this:
a) Noted access keeps two copies of the code. Does access remove the
compilation (decompile?) every time I edit the code? I found a strange
behavious of access - I add objects, code etc. to the app, do a compile and
the file size bloats. No amount of compacting reduces the filesize. Then
after few days, when I run a routine compact process the file size drops
several MBs (say from 10MB to 6MB) - seemingly without any reason. Why is
this happening?

b) How do I decompile the code manually?

TIA
Anand
 
When you modify a form, Access makes a copy of the old form (so it can
revert to that if you don't save your changes.) This has the effect of
increasing the database size (2 copies of the form), and that's addressed by
compacting the database.

There are reasons why a compile may not reduce the database size: some
sensible, others are just problems with Access. If you explicitly decompile,
then compact, then compile, it will often reduce the size more than merely a
compact does. If you SaveAsText, delete the form, compact, then
LoadFromText, and compile it may reduce it even further. It seems that
Access does not do a perfect job of managing the space in a database file.

BTW, David's point about turning off Compile On Demand is an important one.
 
a) Noted access keeps two copies of the code. Does access remove
the compilation (decompile?) every time I edit the code?

VBA compiles different parts incrementally, so there can be many
different stages. Michael Kaplan, who knows about these things,
posted that there are ELEVEN states of compilation, and writes:

Thats right, internally there are 11 different compilation
levels between decompiled and fully compiled like you would find
in an MDE. As you make objects dirty, you will decompile the
project, but dirtying Module1 does not remove all the "compiled"
info about Module2 or Form1, for example. The exact levels are
impossible to even detect unless you have source and debugging
symbols for VBA, and insanely difficult even then.... so lets
just leave it as read that the yes/no question of "is it
compiled?" has many subcategories under the NO answer that
essentially mean its not compiled but some parts of it are kind
of.
From "The real deal on the /Decompile switch"
http://trigeminal.com/usenet/usenet004.asp?1033
I found a strange
behavious of access - I add objects, code etc. to the app, do a
compile and the file size bloats. No amount of compacting reduces
the filesize. Then after few days, when I run a routine compact
process the file size drops several MBs (say from 10MB to 6MB) -
seemingly without any reason. Why is this happening?

Good question. It could be that the compact routine has some
internal thresholds and won't discard data pages except in
increments, i.e., only every 1MB or something like that. I don't
think it works that way for data tables, but it might for the VBA
project.

I'm pretty certain that a regular compact does *not* delete
discarded p-code pages (i.e., the compiled VBA code), because that's
internal to the BLOB field in which the entire Access project is
stored. My guess is that certain cleanup routines kick in via VBA at
certain points when the BLOB field gets too disordered. But I'm only
guessing on that.

I try to keep that BLOB field as clean as possible by keeping
COMPILE ON DEMAND turned OFF, compiling frequently and
decompiling/compacting/compiling on a regular basis. I consider it
part of good housekeeping to keep things running smoothly, somewhat
like keeping the tires on your car properly inflated and changing
the oil regularly. If you never do the things I recommend, it would
be just like running your car without ever doing those maintenance
tasks -- eventually, the car is going to stop running.
b) How do I decompile the code manually?

I recently posted detailed instructions in this thread on
Stackoverflow.com:

http://stackoverflow.com/questions/1147702/rookie-ms-access-creating-
the-front-end-mde/1148573#1148573
 
Back
Top