当前位置:网站首页>Gbase 8s UDR memory management_ 01_ mi_ alloc
Gbase 8s UDR memory management_ 01_ mi_ alloc
2022-07-25 19:29:00 【Eight delicacies tofu】
function mi_alloc() The role of is : Allocate a user memory block of a specified size , And return a pointer to the block .
1. grammar
void *mi_alloc(size)
mi_integer size;
size Number of bytes to allocate .
On the client side LIBMI Valid in application ? | Valid in user-defined routines ? |
yes | yes |
2. usage
function mi_alloc() The role of is : by DataBlade API The number of bytes of user memory allocated by the module .mi_alloc() Function is the constructor of user memory .
Server side : from C From the perspective of user-defined routines , The behavior of this function is similar to malloc() system call , Only the database server can be recycled mi_alloc() Allocated memory . The delta function is going to be : Allocate memory for the current memory duration . By default , The current memory duration is PER_ROUTINE. Use PER_ROUTINE The duration of the , The database server is C UDR Release the allocated memory after returning .
Except callback routines , You can change the memory duration in any of the following ways :
1, Use mi_dalloc() instead of mi_alloc() To allocate memory .
mi_dalloc() The function works the same way as mi_alloc() identical , And provide the option of specifying the duration .
2, Calling mi_alloc() Before , First call mi_switch_mem_duration().
function mi_switch_mem_duration() Used to change the current memory duration of all subsequent memory allocations .
stay UDR Routine , When an exception is thrown , The database server is automatically released mi_alloc() Allocated memory .
Important note : stay C UDR in , Use DataBlade API Memory management function to allocate memory . Use DataBlade API The memory management function can ensure that the database server can automatically release memory , Especially in the case of return value or exception , Otherwise, the routine will not be able to free memory .
client : On the client side LIBMI In the application ,mi_alloc() Working mode and malloc() Exactly the same : It allocates storage on the heap of the client process . The database server does not perform any automatic storage retrieval . client LIBMI Application must use mi_free() To explicitly release mi_alloc() All assignments made . client LIBMI Application ignores memory duration .
client LIBMI Applications can use DataBlade API Memory management function or system memory management function ( Such as malloc()).
function mi_alloc() The role of is : Returns a pointer to the newly allocated user memory . Cast this pointer to match the user-defined buffer or allocated structure .DataBlade API Modules can be used mi_free() To release the mi_alloc() Allocated memory ( When the memory is no longer needed ).
3. Return value
One void The pointer .
Pointer to newly allocated memory . Cast this pointer to match the user-defined buffer or structure for which memory is allocated .
NULL
Function cannot allocate memory .
mi_alloc() The function will not raise... When encountering a runtime error MI_Exception event . therefore , It does not cause callbacks to be called .
边栏推荐
- [iniparser] simple use of the project configuration tool iniparser
- 平衡二叉树
- 帝国CMS7.5仿《问答库》题库问答学习平台网站源码 带手机版
- 房地产行业大洗牌
- Youfu force supercomputing provides customized high-performance computing services for customers
- 一个函数中写多少行代码比较合适呢? 代码整洁之道
- Youfu network was invited to attend the 2022 national CIO conference and won the title of "CIO trusted brand"
- Fearless of high temperature and rainstorm, how can Youfu network protect you from worry?
- [applet development] do you know about applet development?
- Talk about 11 tips for interface performance optimization
猜你喜欢

重磅!《几何深度学习》新书发布,帝国理工/DeepMind等图ML大牛共同撰写,160页pdf阐述几何DL基础原理和统一框架

小程序毕设作品之微信校园维修报修小程序毕业设计成品(2)小程序功能

小程序毕设作品之微信校园维修报修小程序毕业设计成品(3)后台功能

Improvement of wechat applet 29 hot search list ②

TFIDF examples and explanations

由一个蓝桥杯基础题报时助手而引出的常见误区

基于PHP的中非南南合作信息交流平台网站建设

Use of swift basic codable (jsonencoder jsondecoder)

Solve the problem that the win10 account has no administrator rights

Sccm2012r2 network deployment reinstallation system
随机推荐
新瓶装老酒--近期APT32(海莲花)组织攻击活动样本分析
NPM semantic version control, solution console prop being mutated: "placement" error
[iniparser] simple use of the project configuration tool iniparser
Flutter 小技巧之优化你使用的 BuildContext
How to analyze qiime2 after obtaining picrust2 results
Hash undirected graph visualization
Basic music theory -- configuring chords
Illegal mix of collations for operation ‘UNION‘(bug记录)
微信小程序 27 进度条的动态实现和搜索框、热搜榜的静态搭建
Why learn service grid istio
【DETR用于3D目标检测】DETR3D: 3D Object Detection from Multi-view Images via 3D-to-2D Queries
Youfu network was invited to attend the 2022 national CIO conference and won the title of "CIO trusted brand"
聊聊接口性能优化的11个小技巧
Leetcode skimming: dynamic programming 07 (different binary search trees)
Pymoo learning (7): Parallelization
加州大学|用于未指定环境的可行对抗鲁棒强化学习
telnet安装以及telnet(密码正确)无法登录!
小程序毕设作品之微信校园维修报修小程序毕业设计成品(2)小程序功能
Kcon 2022 highlights and agenda revealed!
【刷题记录】21. 合并两个有序链表