Skip to content

Memory

The transactions, transfers and outputs that a wallet or a daemon returns are linked both ways, in cycles that the garbage collector of Python does not see. free breaks the links of what an application is done with, so that it is freed (Memory).

free(*args, **kwargs) staticmethod

free(block: MoneroBlock) -> None
free(blocks: typing.Sequence[MoneroBlock]) -> None
free(tx: MoneroTx) -> None
free(txs: typing.Sequence[MoneroTxWallet]) -> None
free(transfers: typing.Sequence[MoneroTransfer]) -> None
free(outputs: typing.Sequence[MoneroOutputWallet]) -> None
  • free(block): Break the internal parent/child shared_ptr cycles (tx <-> block, transfer <-> tx, output <-> tx, ...) that would otherwise keep this block's data alive forever, since Python's cyclic garbage collector cannot see reference cycles hidden inside C++ shared_ptr members.
  • free(blocks): Free each of the given blocks. See free(block).
  • free(tx): Free the block that owns this transaction (creating one first if the transaction is unconfirmed). See free(block).
  • free(txs): Free the distinct blocks referenced by the given transactions. See get_blocks_from_txs and free(block).
  • free(transfers): Free the distinct blocks referenced by the given transfers. See get_blocks_from_transfers and free(block).
  • free(outputs): Free the distinct blocks referenced by the given outputs. See get_blocks_from_outputs and free(block).

Parameters:

Name Type Description Default
block MoneroBlock

block to free.

required
blocks list[MoneroBlock]

blocks to free.

required
tx MoneroTx

transaction whose block should be freed.

required
txs list[MoneroTxWallet]

transactions whose blocks should be freed.

required
transfers list[MoneroTransfer]

transfers whose blocks should be freed.

required
outputs list[MoneroOutputWallet]

outputs whose blocks should be freed.

required

get_blocks_from_txs(txs) staticmethod

Get distinct blocks from transactions.

Parameters:

Name Type Description Default
txs list[MoneroTxWallet]

Transactions to get blocks from.

required

Returns:

Type Description
list[MoneroBlock]

Distinct blocks obtained from transactions.

get_blocks_from_transfers(transfers) staticmethod

Get distinct blocks from transfers.

Parameters:

Name Type Description Default
transfers list[MoneroTransfer]

Transfers to get blocks from.

required

Returns:

Type Description
list[MoneroBlock]

Distinct blocks obtained from transfers.

get_blocks_from_outputs(outputs) staticmethod

Get distinct blocks from outputs.

Parameters:

Name Type Description Default
outputs list[MoneroOutputWallet]

Outputs to get blocks from.

required

Returns:

Type Description
list[MoneroBlock]

Distinct blocks obtained from outputs.