Flutter Engine
The Flutter Engine
allocation.h
Go to the documentation of this file.
1// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
2// for details. All rights reserved. Use of this source code is governed by a
3// BSD-style license that can be found in the LICENSE file.
4
5#ifndef RUNTIME_PLATFORM_ALLOCATION_H_
6#define RUNTIME_PLATFORM_ALLOCATION_H_
7
9#include "platform/assert.h"
10
11namespace dart {
12
13void* calloc(size_t n, size_t size);
14void* malloc(size_t size);
15void* realloc(void* ptr, size_t size);
16
17// Stack allocated objects subclass from this base class. Objects of this type
18// cannot be allocated on either the C or object heaps. Destructors for objects
19// of this type will not be run unless the stack is unwound through normal
20// program control flow.
22 public:
25
26 private:
27 DISALLOW_ALLOCATION();
28 DISALLOW_COPY_AND_ASSIGN(ValueObject);
29};
30
31// Static allocated classes only contain static members and can never
32// be instantiated in the heap or on the stack.
33class AllStatic {
34 private:
35 DISALLOW_ALLOCATION();
36 DISALLOW_IMPLICIT_CONSTRUCTORS(AllStatic);
37};
38
40 public:
42
43 // Intercept operator new to produce clearer error messages when we run out
44 // of memory. Don't do this when running under ASAN so it can continue to
45 // check malloc/new/new[] are paired with free/delete/delete[] respectively.
46#if !defined(USING_ADDRESS_SANITIZER)
47 void* operator new(size_t size) { return dart::malloc(size); }
48
49 void* operator new[](size_t size) { return dart::malloc(size); }
50
51 void operator delete(void* pointer) { ::free(pointer); }
52
53 void operator delete[](void* pointer) { ::free(pointer); }
54#endif
55};
56
57} // namespace dart
58
59#endif // RUNTIME_PLATFORM_ALLOCATION_H_
Definition: dart_vm.cc:33
void * malloc(size_t size)
Definition: allocation.cc:19
void * calloc(size_t n, size_t size)
Definition: allocation.cc:11
void * realloc(void *ptr, size_t size)
Definition: allocation.cc:27
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
Definition: switches.h:259