data.drop
After copying data from a passive (data...) object into memory, if you no longer need it and want to free up the memory, then you can drop the passive data. After you have dropped the passive data you will not be able to use it again. This is only a hint to the computer running the WASM module, it may not actually remove the passive data from system memory.

Syntax

data.drop $passiveData

Parameters

$passiveData
This points to a passive (data...) object to be dropped.

Example

;; Create memory
(memory 1)

;; Create passive data
(data $passiveData "Hello World")

;; Create function
(func $copyPassiveData
  ;; Set the offset within memory to copy the data to
  i32.const 1024

  ;; Set the offset within the passive data to copy the data from
  i32.const 0

  ;; Set the number of bytes to copy
  i32.const 11

  ;; Copy the passive data into memory
  memory.init $passiveData

  ;; Memory now contains the "Hello World" text

  ;; Remove the passive data section from memory now that
  ;; we no longer need it
  data.drop $passiveData
)