当前位置:网站首页>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 .
边栏推荐
- Youfu network was invited to attend the 2022 national CIO conference and won the title of "CIO trusted brand"
- Hash undirected graph visualization
- Sccm2012r2 network deployment reinstallation system
- Kcon 2022 highlights and agenda revealed!
- GBASE 8s UDR内存管理_01_mi_alloc
- binarySearch基础二分查找
- Basic practice of Blue Bridge Cup - shape retrieval of matrix (C language)
- Improvement of wechat applet 26 playing music page ②
- 小程序毕设作品之微信校园维修报修小程序毕业设计成品(3)后台功能
- Scala基础【集合01】
猜你喜欢

鸿蒙-大喵计算画板-简介
![[record of question brushing] 21. Merge two ordered linked lists](/img/81/5f1ab0054ef5e8cba32f7a546a64c4.png)
[record of question brushing] 21. Merge two ordered linked lists

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

Dynamic implementation of wechat applet 27 progress bar and static construction of search box and hot search list

What is the application value of MES management system

小程序毕设作品之微信校园维修报修小程序毕业设计成品(7)中期检查报告

高并发下如何保证数据库和缓存双写一致性?

Introduction to web security ICMP testing and defense

Talk about 11 tips for interface performance optimization

Sccm2012r2 network deployment reinstallation system
随机推荐
Have you ever seen this kind of dynamic programming -- the stock problem of state machine dynamic programming (Part 1)
GBASE 8s UDR内存管理_03_mi_realloc
Wechat campus maintenance and repair applet graduation design finished product (7) Interim inspection report
balanced binary tree
基于海思3559 高效率的 0延时 0拷贝 qt播放器方案
蓝桥杯基础练习——矩阵的回形取数(C语言)
Wechat campus maintenance and repair application applet graduation design finished product of applet completion work (6) opening defense ppt
Network packet multi-layer transmission demonstration
高端旗舰投影仪选购指南:当贝X3 Pro、当贝F5观影更沉浸!
【刷题记录】21. 合并两个有序链表
哈希无向图可视化
微信小程序 28 热搜榜的完善①
【HDLBits 刷题】Verilog Language(3)Modules: Hierarchy 部分
Youfu network was invited to attend the 2022 national CIO conference and won the title of "CIO trusted brand"
C# 合并集合
微信小程序 26 播放音乐页的完善②
Solve the problem that the win10 account has no administrator rights
University of California | feasible confrontation robust reinforcement learning for unspecified environments
Why learn service grid istio
Is there a "fingerprint" in the structure of AAAI 2022 | Gan? Generating network structure from forged image traceability