interop.Reference returns undefined value
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 25/100
- issue の種類
- バグ
- 明瞭さ
- 説明が足りない
- 活発さ
- 停滞
- 技術スタック
- ios, typescript
調査の方向性
まず、NativeScript iOS 8.1 で interop.Reference、vm_statistics64、vm_statistics、host_statistics64、host_statistics に関して報告された動作を再現します。割り当てられた vmStat データと、vmStatRef.value.free_count を通じて公開される値を比較します。返されたフィールドが undefined になる理由を特定し、報告されたプラットフォームで機能する空きメモリの結果を確認できれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Hi everyone,
I need your help to understand why the vmStatRef.value.free_count in the below code returns undefine value.
I am using NativeScript 8.1. The platform is iOS.
"devDependencies": {
"@nativescript/android": "~8.1.1",
"@nativescript/core": "~8.1.4",
"@nativescript/ios": "~8.1.0",
"@nativescript/types": "~8.1.1",
"@nativescript/webpack": "^3.0.0",
"prompt": "^1.2.0",
"rimraf": "^3.0.2",
"semver": "^7.3.5",
"ts-node": "^10.4.0",
"ts-patch": "^1.4.4",
"tslint": "^6.1.3",
"typescript": "~4.4.4"
}
The git repository is https://github.com/DeepakArora76/nativescript-dna-deviceinfo
Here is a 64-bit implementation
static freeMemory(): number {
const KERN_SUCCESS = 0;
const HOST_VM_INFO = 2;
const hostSize = new interop.Reference(interop.sizeof(vm_statistics64)/interop.sizeof(interop.types.int64));
const hostPort = mach_host_self();
const pageSize = new interop.Reference(0);
host_page_size(hostPort, pageSize);
const vmStat = interop.alloc(interop.sizeof(vm_statistics64));
let freeMem = -1;
if (host_statistics64(hostPort, HOST_VM_INFO, vmStat, hostSize) === KERN_SUCCESS) {
const vmStatRef = new interop.Reference<vm_statistics64>(vm_statistics64, vmStat);
freeMem = vmStatRef.value.free_count * pageSize.value;
}
return freeMem;
}
I also tried vm_statistics instead of vm_statistics64 and that too failed as well!
32-bit implementation
static freeMemory(): number {
const KERN_SUCCESS = 0;
const HOST_VM_INFO = 2;
const hostSize = new interop.Reference(interop.sizeof(vm_statistics)/interop.sizeof(interop.types.int32));
const hostPort = mach_host_self();
const pageSize = new interop.Reference(0);
host_page_size(hostPort, pageSize);
const vmStat = interop.alloc(interop.sizeof(vm_statistics));
let freeMem = -1;
if (host_statistics(hostPort, HOST_VM_INFO, vmStat, hostSize) === KERN_SUCCESS) {
const vmStatRef = new interop.Reference<vm_statistics>(vm_statistics, vmStat);
freeMem = vmStatRef.value.free_count * pageSize.value;
}
return freeMem;
}
- 主要言語
- JavaScript
- スター
- 150
- フォーク
- 43
- 平均マージ
- 3日 10時間
- マージ済み PR(30日)
- 22
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
NativeScript/ios のほかの issue
-
難易度 5/5 1週間以上 初心者へのやさしさ 38/100
NativeScript/ios#459 · コメント 1 件 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
NativeScript/ios#445 ·
-
難易度 3/5 3〜5日 初心者へのやさしさ 66/100
NativeScript/ios#414 ·
-
question
難易度 4/5 3〜5日 初心者へのやさしさ 34/100
NativeScript/ios#364 · コメント 2 件 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
NativeScript/ios#355 ·
NativeScript/ios の issue をすべて見る
似ている issue
-
bug customer-eng Durable Agents Inngest status: needs triage
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
-
optimization optimization:agents-md-curator
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
githubnext/gh-aw-cao#13475 ·
-
[BUG]: "Clear All" in Settings doesn't clear the saved analysis, old data comes back after reload オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
AOSSIE-Org/OrgExplorer#253 · コメント 1 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
oxc-project/oxc#26944 ·
-
ai-observability bug team/ai-observability
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100