Live data from Hacker News

I built a vector map from scratch

ckochis.com

31–40 of 43 posts

Re: I built a vector map from scratch

#31

Earlier quoted context omitted.

Interesting, my hunch would be something about the webgl buffers not getting freed, since they’re running in a tight loop. I’ll do some digging.

From a quick look it seems like you're doing gl.createBuffer() in a loop each time you're drawing, and never call gl.deleteBuffer(). It seems like WebGL will call deleteBuffer() automatically when the object is garbage collected by the JS runtime, but calling it explicitly when you're done with it will probably fix this particular issue. Also a suggestion, try to allocate your buffers only once on setup, and reuse th…

Great pointers, I’ll give these a shot. Still new to this so appreciate the suggestions!

Re: I built a vector map from scratch

#34

Earlier quoted context omitted.

Interesting, my hunch would be something about the webgl buffers not getting freed, since they’re running in a tight loop. I’ll do some digging.

From a quick look it seems like you're doing gl.createBuffer() in a loop each time you're drawing, and never call gl.deleteBuffer(). It seems like WebGL will call deleteBuffer() automatically when the object is garbage collected by the JS runtime, but calling it explicitly when you're done with it will probably fix this particular issue. Also a suggestion, try to allocate your buffers only once on setup, and reuse th…

I moved the createBuffer call out of the render loop, and I think the memory issues on FF should be working better (at least on FF 103).

Re: I built a vector map from scratch

#36

This reliably and repeatedly locks up and crashes my mobile embedded browser and its parent app, my HN reader (Materialistic). I've never seen a more aggressively crashing site in all my years... took me 6 tries to post this comment, only once I bypassed the linked article/site.

Ah, sorry to hear about that! I actually just pushed a fix for a similar crashing issue in Firefox, would be curious to hear if that resolved your issues as well.

Re: I built a vector map from scratch

#39

The demo map crashed my iPhone in the weirdest way. After zooming in and out a bit, the screen went dark, then fully pink , then it restarted.

Yep, my phone too. I'm on a pixel 6.

My Motorola g9 with Chrome too. When I restarted Chrome it crashed again and again untill I finally managed to close the tab containing the blog post.

edit: But I like your blog post, now that I opened it on my Mac.

Re: I built a vector map from scratch

#40

Earlier quoted context omitted.

From a quick look it seems like you're doing gl.createBuffer() in a loop each time you're drawing, and never call gl.deleteBuffer(). It seems like WebGL will call deleteBuffer() automatically when the object is garbage collected by the JS runtime, but calling it explicitly when you're done with it will probably fix this particular issue. Also a suggestion, try to allocate your buffers only once on setup, and reuse th…

I moved the createBuffer call out of the render loop, and I think the memory issues on FF should be working better (at least on FF 103).

Can confirm the issue is solved for me.
Post reply on HN