ink_allocator/lib.rs
1// Copyright (C) Use Ink (UK) Ltd.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15//! Crate providing allocator support for all Wasm compilations of ink! smart contracts.
16//!
17//! The allocator is a bump allocator whose goal is to have a small size footprint.
18//! It never frees memory, having this logic in place would increase the size footprint
19//! of each contract.
20
21#![doc(
22 html_logo_url = "https://use.ink/img/crate-docs/logo.png",
23 html_favicon_url = "https://use.ink/crate-docs/favicon.png"
24)]
25#![cfg_attr(not(feature = "std"), no_std)]
26
27#[cfg(not(any(feature = "std", feature = "no-allocator")))]
28#[global_allocator]
29static mut ALLOC: bump::BumpAllocator = bump::BumpAllocator {};
30
31#[cfg(not(any(feature = "std", feature = "no-allocator")))]
32pub mod bump;
33
34// todo
35#[cfg(all(
36 test,
37 feature = "std",
38 feature = "ink-fuzz-tests",
39 target_os = "dragonfly"
40))]
41#[macro_use(quickcheck)]
42extern crate quickcheck_macros;