/    Sign up×
Community /Pin to ProfileBookmark

0x800a001c – Microsoft JScript runtime error: Out of stack space

I need to display all the records in a kendo view tree view at one go. Means at load of tree, I want all the nodes of my hierarchical data to be displayed. When data is less, I am getting no issue. But when my data is high, I am getting stack overflow error at line number:3, say.

When I debug the visual studio code, I get : “0x800a001c – Microsoft JScript runtime error: Out of stack space”

Actually what is happening, when a child node is displayed, kendo checks for the parent node. So if we have multiple child nodes, recursive calls are happening to get the parent node. With huge data, recursive calls are huge. Hence getting stack overflow error. Can anyone here help me out what I should change in my code.

I am using MVC for this. And ‘treeData’ contains json data. The data is coming from the service in hierarchical format.

_intializeStudentTree: function () {
var abc = this;
var treeData = new kendo.data.HierarchicalDataSource({
transport: {
read: {
url: “controller1/method1”,
dataType: “json”,
type: “POST”,
contentType: “application/json; charset=utf-8”
},
parameterMap: function (options) {
options[‘StudentID’] = abc.options.list.StudentId;
options[‘StudentDetails’] = abc.options.list.StudentDetails;
return JSON.stringify(options);
}
},
schema: {
model: {
children: “ChildRecords”
}
}
});

abc.ListTree = abc.element.find(‘.tree-view’).kendoTreeView({
template: kendo.template($(“#temp-treeview”).html()),
animation: {
expand:false
},
dataSource: treeData,
dataTextField: [“StudentLevel”],
loadOnDemand: false,
dataBound: function () {
abc.ListTree.expand(“.k-item”);
}
}).data(‘kendoTreeView’);

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@deathshadowJul 25.2014 — In order to hit that error, you'd have to be trying to load in excess of a GIGABYTE of JS variables, or your code is using a painfully bad recursive call or hitting up against some framework's code bloat ... and since you've got all those pesky dollar signs in there -- little from column A, little from column B?

It sounds like you're just flat out sending too much data client-side at once.

The "stack" is a section of memory used to store variables that are not retained long term; this includes function variables in non-object functions (though that's iffy depending on the actual JS engine, some are really sucktastic at garbage collection), return vectors and states for function calls, and a host of other temporary values.

Given the gross inefficiencies of the JS object model, it's likely your parsed tree is just too big for the browser's stack to handle it... shame JS doesn't have real pointers and a proper 'heap' in addition to the stack... but that's an interpreted language for you.

Is there any way you can shift more of the processing server-side so you're not trying to download a massive tree data-set to the browser where bandwidth alone would be a half hour page load (given how much you'd have to have in memory to get a stack error in IE)

I hit up against a similar issue about eight years ago where I client wanted a massive data-set (1000 master records of 40 sub-records apiece) where it ended up being so many DOM elements you couldn't even scroll through it. The entire idea just wasn't viable as there's just some things the HTML and JS engines cannot handle.
×

Success!

Help @aspea spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.14,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,
)...