getmemoryinfo - Bitcoin Cash

This method returns information about the node's memory usage, either as a human-readable summary or as raw allocator statistics.

Parameters

ParameterTypeRequiredDescription
modestringNostats for a usage summary, or mallocinfo for raw allocator data. Default stats

Request

bashcurl --location --request POST 'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/' \
--header 'Content-Type: application/json' \
--data-raw '{
    "jsonrpc": "2.0",
    "method": "getmemoryinfo",
    "params": ["stats"],
    "id": "getblock.io"
}'

example.js

javascriptconst axios = require('axios');
const { data } = await axios.post('https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/', {
  jsonrpc: '2.0', method: 'getmemoryinfo',
  params: ['stats'], id: 'getblock.io'
});
console.log(data.result.locked.used);

example.py

pythonimport requests

response = requests.post(
    'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/',
    headers={'Content-Type': 'application/json'},
    json={
        'jsonrpc': '2.0',
        'method': 'getmemoryinfo',
        'params': ["stats"],
        'id': 'getblock.io'
    }
)

print(response.json()['result'])

example.rs

rustuse reqwest::Client;
use serde_json::{json, Value};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = Client::new();

    let response = client
        .post("https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/")
        .header("Content-Type", "application/json")
        .json(&json!({
            "jsonrpc": "2.0",
            "method": "getmemoryinfo",
            "params": ["stats"],
            "id": "getblock.io"
        }))
        .send()
        .await?
        .json::<Value>()
        .await?;

    println!("Result: {}", response["result"]);
    Ok(())
}

Response

json{
    "error": null,
    "id": "getblock.io",
    "result": {
        "locked": {
            "used": 130464,
            "free": 131072,
            "total": 261536,
            "locked": 261536,
            "chunks_used": 2038,
            "chunks_free": 2
        }
    }
}

Response Parameters

ParameterTypeDescription
errornull|objectError object when the call fails, otherwise null
idstringRequest identifier matching the request
resultobjectObject of node memory usage information

Locked Object

FieldTypeDescription
usednumericBytes of locked memory currently in use
freenumericBytes of locked memory available
totalnumericTotal locked memory in bytes

Use Cases

  • Node Diagnostics: Monitor locked memory pools on a dedicated node
  • Capacity Alerts: Alert when memory usage approaches configured limits
  • Performance Tuning: Inspect allocator statistics for tuning
  • Operations Dashboards: Track node memory alongside other health metrics

Error Handling

Error CodeMessageDescription
-32700Parse errorRequest body is not valid JSON
-32600Invalid requestThe JSON sent is not a valid request object
-32603Internal errorNode failed to read the requested chain state