Spec-Zone.ru › Octave 6

A.1.10 Выделение локальной памяти в файлах Oct

Выделение памяти внутри файла oct может показаться простым, так как можно использовать операторы C++ new/delete. Однако в этом случае необходимо соблюдать особую осторожность, чтобы избежать утечек памяти. Предпочтительный способ выделения памяти для локального использования — использование макроса OCTAVE_LOCAL_BUFFER. Пример его использования:

OCTAVE_LOCAL_BUFFER (double, tmp, len)

который возвращает указатель tmp типа double * длиной len.

В этом случае Octave будет следить за подсчетом ссылок и областью видимости переменной и правильно освободит память без вмешательства программиста.

© 1996–2022 The Octave Project Developers
Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are preserved on all copies.
Permission is granted to copy and distribute modified versions of this manual under the conditions for verbatim copying, provided that the entire resulting derived work is distributed under the terms of a permission notice identical to this one.
Permission is granted to copy and distribute translations of this manual into another language, under the above conditions for modified versions.
https://docs.octave.org/v5.2.0/Allocating-Local-Memory-in-Oct_002dFiles.html

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API