[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Octave Memory Management

From: Thomas D. Dean
Subject: Octave Memory Management
Date: Sat, 17 Aug 2019 18:37:31 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0

I have an .oct file that I want to open a device, return the pointer to the device structure.

In octave:
octave> dev_ptr = oct_file("open");
octave> for idx = 1:10
          dat = oct)file()
octave> rc = oct_file("close", dev_prt)

In the .cc file,

  OCTAVE_LOCAL_BUFFER(unit32_t, dev_ptr, 1);
  if (arg == "open") {
    return dev_ptr;

  if (arg == "close") {

  OCTAVE_LOCAL_BUFFER (uint8_t, dat_buf, num_bytes );

Does octave keep the allocation of dev_ptr between function calls?

Is it possible to use a static variable in the .cc file? Would I have to free it when the device is closed?

I can post the full application if necessary.

Tom Dean

reply via email to

[Prev in Thread] Current Thread [Next in Thread]