0

I am using d3.js in Grails. I have a view called vis. In the script section I called:

<body>
   <script>
       ...
       d3.csv("data", function(error, data) {
           if (error) throw error;           
            ...
       }
   </script>
</body>

In my UrlMappings I have:

"/vis/data"(view:'/vis/data.csv')

When the page load I am getting the following error:

Class: java.lang.OutOfMemoryError
Message: Error mapping onto view [/vis/data.csv]: Java heap space
Caused by: Java heap space

My csv file has 230MB.

What is the correct way to call the d3 library in Grails? I want to have my csv file in conf/data folder.

EDIT

I need to load the file in the client side, I believe is not the same question in Large file download using grails

I know that big files need to be reading in parts, but how can I accomplish this in the client side?

Thanks in advance.

Community
  • 1
  • 1
Larx
  • 161
  • 1
  • 4
  • 16
  • this has nothing to do with D3 and everything to do with Grails. post your grails code with the HTTP response containing the CSV data. – emran Jan 02 '16 at 03:07
  • This is the same question. Your error is happening server side and has nothing to do with the client at this point. Have you tried answer to the question I linked? Tackle this problem first and then you really see if you have a problem client side with that much data. – Mark Jan 02 '16 at 16:00

1 Answers1

0

your error is very similar to the following SO: Large file download using grails

basically, avoid loading the whole csv file in to memory. Grails has helpers for files. Since your CSV file is sitting on the file system this should work. If you are transforming the data, you might need to do some research on either creating a buffer, iterating through the data, ect...

Community
  • 1
  • 1
emran
  • 902
  • 6
  • 12