ARnft icon indicating copy to clipboard operation
ARnft copied to clipboard

Memory issue on multiple markers

Open kezmanh opened this issue 4 years ago • 10 comments

I experienced that it is not stable in detection when there are multiple markers. My case is now i have three markers and users need to scan one by one. It works in iPhones even ip6s and some new model Androids. However, a weird case happened in a flagship Android phone in 2018 (I guess not too old enough?) Randomly two of the markers can be detected successfully but the remaining one is always cannot be detected. Uncaught (in promise) RuntimeError: abort(RangeError: WebAssembly.instantiate(): Out of memory: wasm memory). Build with -s ASSERTIONS=1 for more info. The phone didn't open a lot of apps or many tabs in Chrome. But still out of memory. If it is simply a memory issue, is it possible to have a callback to know each marker loaded? Now I can see two "loadNFTMarker -> 0" in console log but not three. I hope there are some callbacks to call so that I can somehow start some new flows for the fix. Thanks.

kezmanh avatar Oct 06 '21 17:10 kezmanh

Anyone who faced this problem, a quick fix is to close the current tab and open a new one.

kezmanh avatar Oct 06 '21 17:10 kezmanh

I can confirm this issue. I have different results by devices. With a old Wiko View i don't get that issue. Maybe something wrong with the Workers?

kalwalt avatar Oct 12 '21 17:10 kalwalt

iOS 15.1.1 Safari occured same issue.

gtk2k avatar Dec 12 '21 03:12 gtk2k

I noticed this error yesterday as well. It seems to be an issue with chrome, but only on mobile devices. Firefox seems to work fine. I'm trying to implement about 7 marker/images right now. But most likely even more in the future. Any fix for this issue would be great.

tkapu avatar Jul 22 '22 08:07 tkapu

-- -- Perhaps an update of ARToolkitNFT 0.9.7 to a later version could fix this issue? Version 1.0.1 says "Enhanced PAGES_MAX. Now you can add up to 20 NFT markers." But it seems to be embedded in ARnft.js as BASE64 ArrayBuffer. -- --

Never mind, that's not the issue. Even if you break the wasm it's throws the memory error if it's more than 2 or 3 entities.

tkapu avatar Jul 22 '22 09:07 tkapu

Okay, I played around with a super basic HelloWorld wasm, and as soon as I add the copiler argument "-s TOTAL_MEMORY=268435456" it will fire the out of memory message. I took the argument from the jsartoolkitnft makem.js file. Would it fix our issue, when we remove that line?

tkapu avatar Jul 29 '22 14:07 tkapu

TOTAL_MEMORY is the Problem. Reducing it helps :)

tkapu avatar Aug 01 '22 11:08 tkapu

@tkapu Sorry for the delay, I'm very busy with my job at the moment, but i can confirm that i had this issue, randomly and not on every devices. The strange i had worste scenarios on newer Mobile devices (never had on desktop Pc). It could be that the Memory could cause some issues but it has also the compiler FLAG https://github.com/webarkit/jsartoolkitNFT/blob/fa5825cfe624d15f092e934b3a3459d827ba8afd/tools/makem.js#L176 that should allow to grow the Memory on demand. You should try to rebuild jsartoolkitNFT and then ARnft with the new args ( reducing the TOTAL_MEMORY). I would test but i have very limited time at the moment...

kalwalt avatar Aug 01 '22 21:08 kalwalt

Updated to iOS 16 today. Didn't help.

tkapu avatar Jan 10 '23 12:01 tkapu

I lowered the total memory size in JsartoolkitNFT see PR #301 now the code is in the master branch i need to update ARnft dependencies as soon as i can.

kalwalt avatar Apr 04 '23 15:04 kalwalt