memory not falling
Moderator: DosItHelp
memory not falling
When I define macro's and push them over endlocal memory increases well over 100MB. When I then undefine them, memory usage is not falling according to taskmgr. As if the gaps where data used to be are being preserved. This is a huge penalty on performance. Yet when I use 'call' to load the exact same macro's from a memoryFileDump. Only 3MB of memory is required to load them ( not pushing over endlocal ). I would expect that if I set a variable and unset it, memory is being released but this seems not to be the case. I find this very odd. It can't be that I got the number of endlocals wrong because the file that loads the macro's is different from the file that calls it. If I had the number of endlocals wrong, the variables wouldn't persist in the global caller environment and would be lost when encountering 'exit /B'.
Re: memory not falling
Yes. This behavior is the base of my method to minimize the performance problems of SET command caused by a very large environment:
Antonio
Aacini wrote:
- When a new variable is defined with a value that exceed the current environment size, the environment is copied to a new area if the area beyond it is not available.
- The new area is just large enough to receive the new variable. No additional space is reserved.
- The important one: When a large variable is deleted, the remaining free space is NOT released. The environment memory block is never shrunk.
. . .
... I added the results of previous program:Code: Select all
Initial environment Origin=004B30, Size=000450
After defined a 4KB variable Origin=00D740, Size=001370
After defined a 8KB variable Origin=00D740, Size=002360
After defined two 8KB variables Origin=00D740, Size=004360
Z2 deleted, there is one 8KB's Origin=00D740, Size=004360
After defined Z2 again: two 8KB's Origin=00D740, Size=004360
After defined three 8KB variables Origin=00D740, Size=006360
Z3 deleted, there is two 8KB's Origin=00D740, Size=006360
Z2 deleted, there is one 8KB's Origin=00D740, Size=006360
Antonio