pub fn alloc(capacity: usize)  -> FixedBuffer {
    let mut buffer = FixedBuffer{
      raw_data: AtomicPtr::new(Self::BUFFER_NULL),
      capacity: capacity,
      data_length: 0,
      ref_cnt: Arc::new(AtomicU64::new(1)),
      must_be_call_dealloc: AtomicBool::new(false),
      recycle_fn_once: None,
    };

    buffer.raw_data = AtomicPtr::new(alloc_bytes_ptr(capacity));
    buffer.must_be_call_dealloc = AtomicBool::new(true);
    return buffer;
  }
/// Create a FixedBuffer by specifying the buffer size, the FixedBuffer internally will apply for memory on the heap, and the FixedBuffer will release its applied memory when it is destroyed
Create a FixedBuffer by specifying the buffer size, the FixedBuffer internally will apply for memory on the heap, and the FixedBuffer will release its applied memory when it is destroyed
Create a FixedBuffer by specifying the buffer size the FixedBuffer internally will apply for memory on the heap and the FixedBuffer will release its applied memory when it is destroyed
pub fn alloc(capacity: usize)  -> FixedBuffer {
    let mut buffer = FixedBuffer{
      raw_data: AtomicPtr::new(Self::BUFFER_NULL),
      capacity: capacity,
      data_length: 0,
      ref_cnt: Arc::new(AtomicU64::new(1)),
      must_be_call_dealloc: AtomicBool::new(false),
      recycle_fn_once: None,
    };
    buffer.raw_data = AtomicPtr::new(alloc_bytes_ptr(capacity));
    buffer.must_be_call_dealloc = AtomicBool::new(true);
    return buffer;
  }
pub fn alloc ( capacity : usize ) -> FixedBuffer { let mut buffer = FixedBuffer { raw_data : AtomicPtr :: new ( Self :: BUFFER_NULL ) , capacity : capacity , data_length : 0 , ref_cnt : Arc :: new ( AtomicU64 :: new ( 1 ) ) , must_be_call_dealloc : AtomicBool :: new ( false ) , recycle_fn_once : None , } ; buffer . raw_data = AtomicPtr :: new ( alloc_bytes_ptr ( capacity ) ) ; buffer . must_be_call_dealloc = AtomicBool :: new ( true ) ; return buffer ; }
Create a FixedBuffer by specifying the buffer size, the FixedBuffer internally will apply for memory on the heap, and the FixedBuffer will release its applied memory when it is destroyed
Create a FixedBuffer by specifying the buffer size the FixedBuffer internally will apply for memory on the heap and the FixedBuffer will release its applied memory when it is destroyed
capacity
usize