definitions fixed

This commit is contained in:
Erjan Gavalji
2015-03-03 10:34:40 +02:00
parent a03ce4ca1d
commit cc829e0152
705 changed files with 321431 additions and 148812 deletions

View File

@@ -0,0 +1,2 @@
import application = require("application");
application.mainModule = "app/LargeObjectArrayMemoryLeakTest/mainPage";

View File

@@ -0,0 +1,55 @@
import pagesModule = require("ui/page");
import stackLayoutModule = require("ui/layouts/stack-layout");
import buttonModule = require("ui/button");
import labelModule = require("ui/label");
import nativeCallsWrapper = require("app/native-calls-wrapper");
import enums = require("ui/enums");
export function createPage() {
var OBJECTS_COUNT = 10000;
var mainStackLayout = new stackLayoutModule.StackLayout();
mainStackLayout.orientation = enums.Orientation.vertical;
var label = new labelModule.Label();
label.width = 500;
mainStackLayout.addChild(label);
if (label.ios) {// Hack for an iOS Arrange problem
label.height = 80;
}
var startButton = new buttonModule.Button();
startButton.height = 50;
startButton.width = 200;
startButton.text = "Allocate memory";
var startButtonClickHandler = function () {
allocateMemory();
};
startButton.on(buttonModule.knownEvents.tap, startButtonClickHandler);
var stopButton = new buttonModule.Button();
stopButton.height = 50;
stopButton.width = 200;
stopButton.text = "Clear memory";
var stopButtonClickHandler = function () {
nativeCallsWrapper.forceGarbageCollection();
};
stopButton.on(buttonModule.knownEvents.tap, stopButtonClickHandler);
mainStackLayout.addChild(startButton);
mainStackLayout.addChild(stopButton);
var allocateMemory = function () {
var datesArray = [];
var i;
for (i = 0; i < OBJECTS_COUNT; i++) {
var date = nativeCallsWrapper.createNativeDate();
datesArray.push(date);
}
};
var page = new pagesModule.Page();
page.content = mainStackLayout;
return page;
}
//export var Page = page;

View File

@@ -0,0 +1,9 @@
export function forceGarbageCollection(): void {
gc();
}
var javaDate = java.util.Date;
export function createNativeDate(): any {
return new javaDate();
}

View File

@@ -0,0 +1,4 @@
declare module "app/native-calls-wrapper" {
export function createNativeDate(): any;
export function forceGarbageCollection(): void;
}

View File

@@ -0,0 +1,7 @@
export function forceGarbageCollection(): void {
__collect();
}
export function createNativeDate(): any {
return NSDate.date();
}

View File

@@ -0,0 +1,2 @@
{ "name" : "LargeObjectArrayMemoryLeakTest",
"main" : "app.js" }