@@ -41,33 +41,33 @@ void *AllocatorAlloc(OrtAllocator *ptr, size_t size) {
4141 // 64-byte aligned, and an additional space in the size of a pointer to store
4242 // the address that RedisModule_Alloc returns.
4343 int offset = 63 + sizeof (void * );
44- void * p1 = (void * )RedisModule_Alloc (size + offset );
45- size_t allocated_size = RedisModule_MallocSize (p1 );
44+ void * allocated_address = (void * )RedisModule_Alloc (size + offset );
45+ size_t allocated_size = RedisModule_MallocSize (allocated_address );
4646 // Update the total number of bytes that onnx is using and the number of accesses
4747 // that onnx made to the allocator.
4848 atomic_fetch_add (& OnnxMemory , allocated_size );
4949 atomic_fetch_add (& OnnxMemoryAccessCounter , 1 );
5050 // This operation guarantees that p2 is the closest 64-aligned address to (p1+size_t).
51- void * * p2 = (void * * )(((size_t )(p1 ) + offset ) & (~63 ));
51+ void * * aligned_address = (void * * )(((size_t )(allocated_address ) + offset ) & (~63 ));
5252 // This stores the address p1 right before p2 (so we can retrieve it when we free).
53- p2 [-1 ] = p1 ;
54- return p2 ;
53+ aligned_address [-1 ] = allocated_address ;
54+ return aligned_address ;
5555}
5656
57- void AllocatorFree (OrtAllocator * ptr , void * p ) {
57+ void AllocatorFree (OrtAllocator * ptr , void * aligned_address ) {
5858 (void )ptr ;
59- if (p == NULL ) {
59+ if (aligned_address == NULL ) {
6060 return ;
6161 }
6262 // Retrieve the address that we originally received from RedisModule_Alloc
6363 // (this is the address that we need to sent to RedisModule_Free).
64- void * p1 = ((void * * )p )[-1 ];
65- size_t allocated_size = RedisModule_MallocSize (p1 );
64+ void * allocated_address = ((void * * )aligned_address )[-1 ];
65+ size_t allocated_size = RedisModule_MallocSize (allocated_address );
6666 // Update the total number of bytes that onnx is using and the number of accesses
6767 // that onnx made to the allocator.
6868 atomic_fetch_sub (& OnnxMemory , allocated_size );
6969 atomic_fetch_add (& OnnxMemoryAccessCounter , 1 );
70- return RedisModule_Free (p1 );
70+ return RedisModule_Free (allocated_address );
7171}
7272
7373unsigned long long RAI_GetMemoryInfoORT () { return OnnxMemory ; }
0 commit comments