Page 2 of 2

Posted: Thu Jul 02, 2009 9:14 am
by Trond
I looked at the generated assembly code. The datasection is writable, and this makes me seriously doubt the claims made about datasections in the manual.

Try these codes and watch the VM column in the task manager, along with the total memory use of the computer. Run each program twice at the same time (use the external debugger). You will see that the first one uses a lot more memory than the second one. This is because placing the data outside the datasection makes what happen that was supposed to happen when the data is put inside the datasection.

Code: Select all

DataSection
  !db 10000000 dup 123 ; almost 10 mb
EndDataSection
CallDebugger
End

Code: Select all

CallDebugger
End
  !db 10000000 dup 123
My results:
No programs running:
Commit Charge: 649M

Two instances of the first program (with datasection) running:
Commit charge: 687M
Mem usage for one program: 2 184 K
VM size for one prorgam: 16 812 K

Two instances of the second program (without datasection) running:
Commit charge: 668M
Mem usage for one program: 2 184 K
VM size for one program: 7 044 K

I thought it was the purpose of the datasection to make sure the last thing happened, but in reality, it keeps the last thing from happening and you will waste a lot of memory.