mapbox / mapbox/mapbox-maps-flutter
Exponential memory usage until crash with PolylineAnnotationManager.createMulti
まだ誰も着手していません。
- 主要言語
- Dart
- スター
- 380
- フォーク
- 204
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
Using PolylineAnnotationManager.createMulti the memory usage increases with each iteration.
With a slower iteration speed the increase is less dramatic.
```dart
import 'dart:async';
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:mapbox_maps_flutter/mapbox_maps_flutter.dart';
List polylines = [];
void main() async {
WidgetsFlutterBinding.ensureInitialized();
MapboxOptions.setAccessToken("");
var data = json.decode(await rootBundle.loadString("path.json")) as List;
for(var n = 0; n < 10; n++) polylines.addAll(data.map((e) => PolylineAnnotationOptions(
geometry: e,
lineWidth: 5.0,
lineColor: Colors.red.value,
lineJoin: LineJoin.ROUND,
)).toList());
runApp(MaterialApp(home: MapSample()));
}
class MapSample extends StatefulWidget {
@override
State createState() => _MapSampleState();
}
class _MapSampleState extends State {
final locationSettings = LocationComponentSettings(
enabled: true,
showAccuracyRing: true,
pulsingEnabled: false,
puckBearingEnabled: true,
puckBearing: PuckBearing.HEADING
);
Stream? location;
PolylineAnnotationManager? polylineAnnotationManager;
@override
initState() {
super.initState();
}
@override
Widget build(BuildContext context) => Scaffold(
body: MapWidget(
key: ValueKey("map"),
cameraOptions: CameraOptions(center: Point(coordinates: Position(-122.04160728, 37.33676622)), zoom: 12, pitch: 0.0),
onMapCreated: (mapboxMap) async {
await Future.wait([
mapboxMap.scaleBar.updateSettings(ScaleBarSettings(enabled: false)),
mapboxMap.gestures.updateSettings(GesturesSettings(rotateEnabled: false)),
mapboxMap.attribution.updateSettings(AttributionSettings(clickable: false, iconColor: 1)),
mapboxMap.location.updateSettings(locationSettings),
]);
polylineAnnotationManager ??= await mapboxMap.annotations.createPolylineAnnotationManager();
Timer.periodic(const Duration(milliseconds: 100), (_) async {
polylineAnnotationManager!.deleteAll();
await polylineAnnotationManager!.createMulti(polylines!);
});
}
)
);
}
```
https://github.com/ristiisa/mbmemleak/tree/annotations
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
Start with the PolylineAnnotationManager.createMulti and deleteAll calls in the provided Dart reproduction, especially the Timer.periodic loop. Run the mbmemleak/annotations reproduction and monitor memory while repeating the loop; done means repeated deletion and creation no longer causes unbounded memory growth or a crash.
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- dart, flutter
- 領域
- mobile
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100