Live.getLastVisitsDetails not returning data beyond a couple of months

Hi, We are trying to query Live.getLastVisitsDetails API for a date range, it gives the following error when I try to go beyond a certain date range (say beyond 2.5 months), here is a sample of parameters I used
method=Live.getLastVisitsDetails&idSite=1&period=range&date=2018-05-17,2018-07-31&format=JSON&filter_limit=-1

Here is the error I received when I tried to fetch more data
{“result”:“error”,“message”:“Allowed memory size of 134217728 bytes exhausted (tried to allocate 9916677 bytes)”}

Can anyone please suggest a workaround so that we can get data for a year or so using the ‘range’ parameter?