I am encountering an out of memory exception with version 9.0.0.142 when adding 283 features to a highlight overlay. It must be something specific in the application, as I’ve tried to reproduce the problem in a standalone example with no success; in fact, in my problem reproduction example, it lets me add all 943 features from the shapefile.
In hopes someone can shed some light on the problem, here is the exception callstack:
System.OutOfMemoryException: Exception of type ‘System.OutOfMemoryException’ was thrown.
at System.Text.StringBuilder.ToString()
at qhM=.vRU=.yhU=(StringBuilder json)
at qhM=.vRU=.zxU=(Object jsonObject)
at ThinkGeo.MapSuite.MvcEdition.Map.EhY=()
at ThinkGeo.MapSuite.MvcEdition.Map.ERY=()
at ThinkGeo.MapSuite.MvcEdition.Map.Render(HtmlTextWriter htmlTextWriter)
at ThinkGeo.MapSuite.MvcEdition.MapBuilder.Render()
at ASP._Page_Partial_cshtml.Execute() in d:\Partial.cshtml:line 196
at System.Web.WebPages.WebPageBase.ExecutePageHierarchy()
at System.Web.Mvc.WebViewPage.ExecutePageHierarchy()
at System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage)
at System.Web.Mvc.RazorView.RenderView(ViewContext viewContext, TextWriter writer, Object instance)
at System.Web.Mvc.BuildManagerCompiledView.Render(ViewContext viewContext, TextWriter writer)
at System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context)
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResult(ControllerContext controllerContext, ActionResult actionResult)
at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass1c.<InvokeActionResultWithFilters>b__19()
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation)
at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass1c.<>c__DisplayClass1e.<InvokeActionResultWithFilters>b__1b()
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult)
at System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName)
OutOfMemory Exception
Hi Jay,
Today I tried to add a lot of features into an HighlightFeatureOverlay, but I hadn’t reproduced that.
I am not sure where is the problem, but it looks OutOfMemoryException is thrown by StringBuilder.ToString, but the StringBuilder require twice memory allocation each time. So it should related with environment also.
I guess there are two reason for it.
1. Too many features added in same overlay, and we need convert them to a string by StringBuilder so we can pass them to client side
2. Your active memory is not enough
Maybe my test hadn’t touch the ceiling so I hadn’t reproduced that. I will tried to test that again, or if you create a standalone project please let me know.
Regards,
Don
Hi Don. I’ve got a sample project that replicates the issue (and hopefully it will for you as well). However, when I try to attach it, it seems to upload and then hangs, and I’m getting what looks like the top part of the words “Server Error” underneath the Choose File button.
Is this something on our end or yours?
Hi Jay,
Sorry for that we are still unable to reproduce the issue. Could you please send the sample to forumsupport@thinkgeo.com.
Thanks,
Peter
Hi Jay,
Sorry we haven’t received the email yet. Could you please try to send it again or append more information about the sample then I’ll try to reproduce the issue.
How to send data to support please refer to wiki.thinkgeo.com/wiki/map_suite_sending_data_to_support
Thanks,
Peter
Hi Peter. Apparently it was just over our email size limit, and I didn’t get a bounce message. I’ve split it into two parts and tried again. Hopefully it will be received this time.
Hi Jay,
Thanks for your demo, it helped a lot. The reason is that we loaded too many features into the HighlightOverlay, which is just a light-weight overlay to be used for showing some awasome features with full-support of mouse, like mouse-over, mouse-out etc. All these features included in HighlightOverlay will be passed to the client side and draw them in browser, in other words, if huge data is loaded, I guess it may runs into a performance issue, as we know, the browser just supports small data drawing.
Could you please provide more information about you requirements it will help us to find out if there is workaround on this?
Thanks,
Peter
Thanks, Peter. I was hoping to be able to provide a bit more interactivity, such as a tooltip displaying some relevant information when hovering over a particular feature. The highlight overlay seemed like an ideal way to do this. However, even with only two hundred features added to it, it seemed to suffer, performance-wise.
Do you have any ideas on providing something like this? I thought about trying to implement some sort of mouse event handler on the map itself, where if the mouse hadn’t moved in such a time, make a MapFilter call to get the info to display.
Hi Jay,
The HighlightOverlay is a lightweight solution, if you want to implement that for many features, I think you should want to implement that by JavaScript AJAX.
You should want to, 1. Capture mouse hover 2. Sent back the feature id 3. Get response via AJAX 4. Show the response information
I think some attached sample in this post should be helpful for that:
thinkgeo.com/forums/MapSuite/tabid/143/aft/11087/Default.aspx
Regards,
Don