onryldz / x-superobject

Delphi Cross Platform Rapid JSON
316 stars 118 forks source link

Out of Memory on large JSON #77

Closed shahriar-b closed 9 years ago

shahriar-b commented 9 years ago

Hi,

Im trying to read a JSON not very large but around 300Kb which contains a JSON array with a json string. when i try to read this json it will go out of memory. when i debug i found out the problem is from line 2107 in XSuperJSON when matching JSON field contain large data with the regex it goes out of memory, is there any workaround to fix this issue? i suspect TRegEX.Matches is not optimized and will easily eat up all the memory.

onryldz commented 9 years ago

Hi, I need more info. Sample project Which version of delphi are you using? *Which platform are you using? (Win, Mac, Android, Ios, etc),

shahriar-b commented 9 years ago

Hi,

  1. sample json to reproduce: https://drive.google.com/file/d/0B39DC6SOjOt1VUtMWkxPMzRLTW8/view?usp=sharing
  2. I tried with XE8 and 10 Seattle. both same
  3. VCL Windows

If you attempt to load attached file in 32bit application you will certainly go out of memory but in 64bit it will consume 3gb of ram to parse that JSON.