Patch (corrected) (demo, screenshots, and heap.trc files) - to fix Memory Leak in "dbf.pas"
The DBF file format is a very convenient, fast, and widely-accepted database standard. (Hey, if it's good enough for Jet Propulsion Laboratories, where it was invented, to store information about planets and stars, then it's good enough for me.)
Sometimes it is helpful to use the DBF format only in memory, without actually saving the results to a disk file. This is useful when speed is more important for a relatively small amount of temporary information which doesn't need to be saved.
Currently, when the programmer sets the DBF storage to "stoMemory" (rather than stoFile), and then closes the application, Free Pascal always leaves behind annoying (embarrassing) memory leaks.
| Attached Demo Program using current "dbf.pas" (without patch, see heap.trc): |
|---|
| 1664 memory blocks allocated : 1120908/1122976 |
| 1662 memory blocks freed : 1116772/1118840 |
| 2 unfreed memory blocks : 4136 |
| True heap size : 1966080 |
| True free heap : 1961504 |
| Should be : 1961560 |
| The attached patch (to branch "fixes_3_2") fixes those memory leaks (see heap.trc): |
|---|
| 1624 memory blocks allocated : 1118179/1120080 |
| 1624 memory blocks freed : 1118179/1120080 |
| 0 unfreed memory blocks : 0 |
| True heap size : 1671168 |
| True free heap : 1671168 |
Respectfully,
Mark A. Paley MarkAPaley@gmail.com