1

what i'm trying to do is save (2GB +-) of data for offline use. i do this using Dexie( wrapper for indexeddb) for my Progressive web app.

My problem is that i use all of my laptops/android/IOS device's memory(RAM).

Is there a way for a progressive web app to save a lor of data without using up all the memory?

-localstorage has limits i think and also relies on memory or am i wrong ? -Filesystem API is it possible ? -LargeLocalStorage is it possible ? (https://github.com/tantaman/LargeLocalStorage)enter image description hereenter image description here enter image description here

  • I'm not sure which one you mean with memory. RAM or Hard Drive. – Thomas Apr 09 '20 at 13:52
  • The best APIs are indeed IndexedDB, and Cache for responses, especially files. If that takes up lots of RAM, it's probably because 1) you're using Chrome 2) you have a memory leak (not revoking ObjectURL, keeping references to all the data you store in the DB…) – Touffy Apr 09 '20 at 13:58

1 Answers1

0

I wouldn't recommend using LargeLocalStorage, because that's an old project that uses old APIs which are not in use today (for example WebSQL in Safari).

Solution for saving big files

I do recommend you to stay with IndexedDB, since it's widely supported (more than the Filesystem API which is only supported in Chrome). However, each of the browsers might limit you in the data that you can store per origin (and not per api, which can help you). In Chrome for example it's up to 6% from your device free space. In the link I've attached you can find more details. Of course, you can use the StorageQuota API to learn more about how much space you have left.

Inspecting memory usage

If you meant memory as RAM and not HDD/SSD - I would suggest inspecting the memory in your device using Chrome dev tools. You can inspect Chrome on your device using Chrome on your workstation. Afterwards, profile your memory and try to see what is using all of it

user3467955
  • 561
  • 5
  • 11
  • ok thank you i will stay with indexeddb but as you said it takes up all of my memory/RAM all the data gets saved there but it is too much data for mobile devices and even my laptop. Is there a way too save the data elsewhere instaid of my RAM – Tillo Loozen Apr 09 '20 at 15:35
  • Can you please describe what you see in your memory profiling? IndexdDB stores the data on the HDD/SSD, so this shouldn't happen to you – user3467955 Apr 09 '20 at 15:42
  • it's almost all "internal array" with no reference to my code – Tillo Loozen Apr 09 '20 at 16:03
  • Thank you for adding the image :). In the image that you have added it seems that your heap is only ~10MB. Are you sure that this tab is consuming all the memory? What are the most RAM consuming processes in your device right now? How much RAM do they use? – user3467955 Apr 09 '20 at 16:23
  • it is defently this tab in chrome ( i have a lot of other chrome tabs open but that should not be a problem) – Tillo Loozen Apr 09 '20 at 16:49