AKRA
AKRA

Reputation: 288

Memory freeing: Assembly NASM x86

I'm wondering about the need for 'memory freeing' in assembly. As an example, suppose we did the following:

section .bss
  _bss_start:
    seed resd 8
  _bss_end:
section .text
  global _start
_start:
  mov dword [seed], 1213432
  mov dword [seed], 231

my question is, would the number 1213432 be completely overwritten by 231 at the [seed] location?

I.e. if we tried to do calculations later on with the number at [seed], might we find errors?

A

Upvotes: 0

Views: 179

Answers (1)

Nate Eldredge
Nate Eldredge

Reputation: 57922

would the number 1213432 be completely overwritten by 231 at the [seed] location?

Yes, a write to memory will completely overwrite the previous contents. There is nothing that needs to be done in between.

I.e. if we tried to do calculations later on with the number at [seed], might we find errors?

No, any further reads to the dword [seed] are guaranteed to yield 231.

Upvotes: 2

Related Questions