Skip to content
This repository was archived by the owner on Nov 17, 2022. It is now read-only.

Commit 412bd94

Browse files
authored
Merge pull request #1416 from NativeScript/ggarabed/update-project-structure-article
docs: Updates to the Project Structure article
2 parents f81d615 + a1fcb0f commit 412bd94

File tree

3 files changed

+158
-81
lines changed

3 files changed

+158
-81
lines changed
Lines changed: 33 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,56 @@
11
---
2-
nav-title: "Custom Flags"
32
title: "Custom Flags"
4-
description: "Tuning with custom flags"
3+
description: "Configure various V8 engine flags in order to improve the performance of your app, or to obtain more comprehensive information during debugging"
54
position: 5
65
previous_url: /core-concepts/android-runtime/advanced-topics/v8-flags
6+
slug: custom-flags
77
---
88

9+
# Custom Flags
910

10-
## Tuning V8
11+
The V8 engine comes with a set of controlling flags that may be useful for fine-grained tuning. You can set these flags in the [secondary package.json configuration file]({% slug structure %}#apppackagejson). This article contains some of the available flags and short explanation on how you can use them. For a complete list of all V8 flags, see the [Flag Definitions header file](https://github.com/v8/v8/blob/6.9.247/src/flag-definitions.h) in GitHub.
1112

12-
V8 comes with a set of controlling flags that may be useful for a fine-grained tuning. Currently, we use `--expose_gc` flag to expose global `gc()` function which comes handy in advanced memory management scenarios. You can set these flags in `package.json` configuration file.
13+
## Expose Garbage Collector
14+
15+
The `--expose_gc` flag exposes a global `gc()` function which can be helpful in [advanced memory management scenarios]({% slug memory-management %}).
1316

1417
```JSON
1518
{
16-
...
17-
"android": {
18-
"v8Flags": "--expose_gc"
19-
}
20-
...
19+
...
20+
"android": {
21+
"v8Flags": "--expose_gc"
22+
}
23+
...
2124
}
2225
```
2326

24-
For example, here are all the flags in V8 `6.6.346` [https://github.com/v8/v8/blob/6.6.346/src/flag-definitions.h](https://github.com/v8/v8/blob/6.6.346/src/flag-definitions.h)
25-
2627
## Timezone Changes
2728

28-
For improved performance V8 keeps a cache of various values used for date / time computation. This may lead to a negative side effect for the application because changes made to the current timezone will not be reflected until the application is restarted.
29-
30-
While this is not a common requirement for most applications, under some circumstances this be needed. To enable this scenario, you can set the `handleTimeZoneChanges` flag:
29+
For improved performance, V8 keeps a cache of various values used for date and time computation. This may lead to a negative side effect for the application because changes made to the current timezone will not be reflected until the application is restarted. While this is not a common requirement for most applications, there are some circumstances where this behavior might be needed. To enable this scenario, you can set the `handleTimeZoneChanges` flag:
3130

3231
```JSON
3332
{
34-
...
35-
"android": {
36-
"handleTimeZoneChanges": true
37-
}
38-
...
33+
...
34+
"android": {
35+
"handleTimeZoneChanges": true
36+
}
37+
...
3938
}
4039
```
4140

4241
As a result, the application will register a [BroadcastReceiver](https://developer.android.com/guide/components/broadcasts) which will be responsible for the [ACTION_TIMEZONE_CHANGED](https://developer.android.com/reference/android/content/Intent.html#ACTION_TIMEZONE_CHANGED) event and automatically invalidate the corresponding cache. Subsequent calls to `new Date()` will then take into account the new timezone.
4342

4443
## Maximum Log Message Size
4544

46-
By default all messages sent to Logcat are limited to 1024 characters and larger messages are automatically truncated. This value can be controlled with the `maxLogcatObjectSize` field:
45+
By default, all messages sent to Logcat are limited to 1024 characters and larger messages are automatically truncated. This value can be controlled with the `maxLogcatObjectSize` field:
4746

4847
```JSON
4948
{
50-
...
51-
"android": {
52-
"maxLogcatObjectSize": 2048
53-
}
54-
...
49+
...
50+
"android": {
51+
"maxLogcatObjectSize": 2048
52+
}
53+
...
5554
}
5655
```
5756

@@ -61,11 +60,11 @@ When you are using a release build there will be no logs to the console, so if y
6160

6261
```JSON
6362
{
64-
...
65-
"android": {
66-
"forceLog": true
67-
}
68-
...
63+
...
64+
"android": {
65+
"forceLog": true
66+
}
67+
...
6968
}
7069
```
7170

@@ -75,11 +74,10 @@ By default, if an exception is thrown when executing JavaScript code which is ca
7574

7675
```JSON
7776
{
78-
...
79-
"discardUncaughtJsExceptions": true
80-
...
77+
...
78+
"discardUncaughtJsExceptions": true
79+
...
8180
}
8281
```
8382

84-
This flag works for iOS as well.
85-
83+
> **NOTE:** The `discardUncaughtJsExceptions` works on iOS as well. This is why in the example above the flag is not assigned to the `android` object.

docs/core-concepts/android-runtime/advanced-topics/memory-management.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
---
2-
nav-title: "Memory Management"
32
title: "Memory Management"
4-
description: "Advanced Memory Management"
3+
description: "Best practices and recommendations on how to improve the performance of your NativeScript mobile app by tuning the memory management"
54
position: 4
5+
slug: memory-management
66
---
77

8-
> **Note:** This is an experimental feature and some details may change in future.
8+
> **NOTE:** This is an experimental feature and some details may change in future.
99
1010
# Introduction
1111

0 commit comments

Comments
 (0)