A
athene
Unregistered / Unconfirmed
GUEST, unregistred user!
1. Apart from bugs in programs, memory leakage, and fragmentation, it is also possible that conscious design decisions actually cause unnecessary or unexpected footprint problems.
<中文>
</中文>
As we have seen before, part of the runtime footprint is used during the execution of the program for storing (intermediate) data.
<中文>
</中文>
How the program handles this intermediate data determines its behavior when the data set grows. It is fairly likely that a routine used for transforming a certain set of data will, at some point, cause the original data and the transformed data to be in memory at the same time.
<中文>
</中文>
An example of this is the aforementioned decompression routine. Designed very badly, this decompression routine might keep all the compressed data in memory while it allocates yet more memory to store all the decompressed data.
<中文>
</中文>
This will not pose a problem for small files;
in fact it is a very fast way of working due to the low level of instruction overhead. Consequently, this routine will seem to work fine during a test phase that used only small files.
<中文>
</中文>
However, as the program is called on to decompress ever larger files in the field, the problem becomes apparent. A better designed program would first take into account the amount of memory available and then
determine the appropriate amount of input data to load.
<中文>
</中文>
2. Java objects can be produced dynamically during execution, for example by object = new ClassName ()
<中文>
</中文>
These objects are stored on the heap and removed by the garbage collector when no longer needed. In this way, storage management in Java is handled by the system, with no need for the dreaded malloc and free procedures, or even for explicit pointers, for that matter.
<中文>
</中文>
Each class is based on another class. A newly defined class is said to be a subclass of the class on which it is based, the superclass. A (sub) class always inherits the methods of its superclass. It may or may not have direct access to the superclass’ internal variables, depending on whether or not the superclass wants that.
<中文>
</中文>
For example, if a superclass, A, has methods M1, M2, and M3, and a subclass, B, defines a new method, M4, then
objects created from B, will have methods M1, M2, M3, and M4.
<中文>
</中文>
The property of a class automatically acquiring all the methods of its superclass is called inheritance, and is an import property of Java. Adding new methods to the superclass’ methods is called extending the superclass.
<中文>
</中文>
As an aside, some object-oriented languages allow classes to inherit methods from two or more superclasses (multiple inheritance), but the Java designers thought this property to be too messy and intentionally left it out.
<中文>
</中文>
<中文>
</中文>
As we have seen before, part of the runtime footprint is used during the execution of the program for storing (intermediate) data.
<中文>
</中文>
How the program handles this intermediate data determines its behavior when the data set grows. It is fairly likely that a routine used for transforming a certain set of data will, at some point, cause the original data and the transformed data to be in memory at the same time.
<中文>
</中文>
An example of this is the aforementioned decompression routine. Designed very badly, this decompression routine might keep all the compressed data in memory while it allocates yet more memory to store all the decompressed data.
<中文>
</中文>
This will not pose a problem for small files;
in fact it is a very fast way of working due to the low level of instruction overhead. Consequently, this routine will seem to work fine during a test phase that used only small files.
<中文>
</中文>
However, as the program is called on to decompress ever larger files in the field, the problem becomes apparent. A better designed program would first take into account the amount of memory available and then
determine the appropriate amount of input data to load.
<中文>
</中文>
2. Java objects can be produced dynamically during execution, for example by object = new ClassName ()
<中文>
</中文>
These objects are stored on the heap and removed by the garbage collector when no longer needed. In this way, storage management in Java is handled by the system, with no need for the dreaded malloc and free procedures, or even for explicit pointers, for that matter.
<中文>
</中文>
Each class is based on another class. A newly defined class is said to be a subclass of the class on which it is based, the superclass. A (sub) class always inherits the methods of its superclass. It may or may not have direct access to the superclass’ internal variables, depending on whether or not the superclass wants that.
<中文>
</中文>
For example, if a superclass, A, has methods M1, M2, and M3, and a subclass, B, defines a new method, M4, then
objects created from B, will have methods M1, M2, M3, and M4.
<中文>
</中文>
The property of a class automatically acquiring all the methods of its superclass is called inheritance, and is an import property of Java. Adding new methods to the superclass’ methods is called extending the superclass.
<中文>
</中文>
As an aside, some object-oriented languages allow classes to inherit methods from two or more superclasses (multiple inheritance), but the Java designers thought this property to be too messy and intentionally left it out.
<中文>
</中文>