Live data from Hacker News

Effectively Managing Memory at Gmail Scale

html5rocks.com

31–40 of 50 posts

Re: Effectively Managing Memory at Gmail Scale

#31
post #17

Earlier quoted context omitted.

So basically one needs to re-implement smart pointers in Javascript, right ? What are the alternative to js style GC,for a language that wouldnt want to the developper to use manual memory allocation.I've heard about ARC.Are there other known architectures?

Smart pointers won't save you. Yes, they'll eliminate the need for collection, by moving the overhead from a single collection to ever construction/destruction. This may be worth it to get a constant framerate, but the overhead doesn't disappear. If anything, it could be greater: allocating from the heap usually costs more than an object allocation done by any sane VM.

Constant framerate, even with overhead, can be preferable to random slowdowns.

Re: Effectively Managing Memory at Gmail Scale

#32
post #13

Earlier quoted context omitted.

I'm not sure I understand how to make zero allocations? Does this mean you create your variables outside of a requestAnimationFrame (rAF) and update their values inside the rAF?

That's what it means, yep. Making object pools, etc. This can be harder than it sounds, to put it mildly. In other words, completely subverting the GC altogether.

Object pools for vectors are damned useful...both Xith3D and Ardor3D in Java had free pools for their vector classes, and using those significantly impacted memory usage and frame delays.

Re: Effectively Managing Memory at Gmail Scale

#33
post #25

Earlier quoted context omitted.

> Wrong..... I don't touch Perl since 2004. Back then it used reference counting, not a GC. Second, the post reads like a problem in the C code. > ParaSail and Rust don't have a GC, period, AFAIK. ATS is too strict for my liking. I was replying about GC alternatives for automatic memory management.

> the post reads like a problem in the C code. Exactly. All GC does is push down the code that can cause problems like double-frees into the language implementation. It doesn't magically make problems like double-free bugs impossible, like so many people say. > I was replying about GC alternatives for automatic memory management. Then why did you respond to and quote something that was talking about something entirel…

> Exactly. All GC does is push down the code that can cause problems like double-frees into the language implementation. It doesn't magically make problems like double-free bugs impossible, like so many people say.

The difference being the compiler vendor vs all the developers using the language.

> Then why did you respond to and quote something that was talking about something entirely different?

Maybe my bad English could not decipher "where the compiler could determine when they can be thrown away, matters would be different. (So, in other words, the compiler inserts `malloc` (or whatever) calls, and ensures that every variable created is either `free`d exactly once after it becomes unreachable".

Re: Effectively Managing Memory at Gmail Scale

#34
post #17

Earlier quoted context omitted.

So basically one needs to re-implement smart pointers in Javascript, right ? What are the alternative to js style GC,for a language that wouldnt want to the developper to use manual memory allocation.I've heard about ARC.Are there other known architectures?

As I said: a pauseless GC with a smart language implementation would be fine. ARC can work, but either requires programmers to prevent loops or needs a GC regardless. Object pools at the language level would be an alternative. (I.e. every object is allocated in a "pool", including pools. When a pool falls out of scope the entire pool is "freed". You can copy objects between pools as necessary.)

thanks for your input.

Re: Effectively Managing Memory at Gmail Scale

#35
post #17

Earlier quoted context omitted.

So basically one needs to re-implement smart pointers in Javascript, right ? What are the alternative to js style GC,for a language that wouldnt want to the developper to use manual memory allocation.I've heard about ARC.Are there other known architectures?

As I said: a pauseless GC with a smart language implementation would be fine. ARC can work, but either requires programmers to prevent loops or needs a GC regardless. Object pools at the language level would be an alternative. (I.e. every object is allocated in a "pool", including pools. When a pool falls out of scope the entire pool is "freed". You can copy objects between pools as necessary.)

> Object pools at the language level would be an alternative. (I.e. every object is allocated in a "pool", including pools. When a pool falls out of scope the entire pool is "freed". You can copy objects between pools as necessary.)

This might be called "memory regions" in the literature, or at least the work on using this memory management scheme in an ML (ML Kit).

Re: Effectively Managing Memory at Gmail Scale

#36

> Game developers, take note: to ensure a 16ms frame time (required to achieve 60 frames per second), your application must make zero allocations, because a single young generation collection will eat up most of the frame time. And this is why GC isn't the be-all and end-all solution to memory management. (As as for people that are screaming "pauseless GC" - it has throughput issues [generally due to fine grained loc…

By far the best write-up about mobile app development and the true cost of GC has been in [0]. It's a very long read but well worth it.

If you took just one rule of thumb from it, let it be this: if you want speed with garbage collected languages, be sure to use at most 1/6 of the overall system memory.

0: http://sealedabstract.com/rants/why-mobile-web-apps-are-slow...

Re: Effectively Managing Memory at Gmail Scale

#37

Gmail still slow. Unrelated: Why haven't Google implemented a Google.com-quality-level search for email?

I find Gmail search to work pretty well for me. The question I have is why the Google Voice iPhone app does not have a search function AT ALL.

I believe they're phasing out the Google Voice apps (although this may not have ever been announced) in favor of more integrated solutions. Now why Hangouts are not searchable, I will never know.

I could care a bit less about the colors and animation strategy Google is using, but why they don't just put a search bar at the top of every product of theirs is a mystery I'm afraid I'll have to live with for quite some time. Even the Google+ app (at least) has terrible search and takes too many clicks - I believe Facebook has actually caught up on this.

Re: Effectively Managing Memory at Gmail Scale

#38
> Anecdotes of Gmail tabs consuming multiple gigabytes of memory on resource-constrained laptops and desktops were being heard increasingly frequently

You know, I think I recall being able to run quite nicely featured GUI mail clients and IRC clients simultaneously on a Pentium 90 with 16 megs of RAM. And, I expect those clients had an order of magnitude less developer effort put into them compared to the GMail client-side code. Meanwhile, I'm quite confident that Gmail team is composed of very, very smart developers. So, what am I missing? Why does GMail require two orders of magnitude more resources?

Re: Effectively Managing Memory at Gmail Scale

#39

Does anyone else feel like Gmail has actually been getting slower in the past year? It feels like it takes a lot longer to load... And once it finally does load, you still end up having to wait a reasonable amount of time for Hangouts.

I've felt that all of Google's services have been getting slower and less user-friendly over the past 5 or 6 years.

Re: Effectively Managing Memory at Gmail Scale

#40
post #2

It is rather odd to think about "scaling" to a single computer, isn't it? This is more bloat management than scaling.

It seems to me that they're referring more to the size of the application. "GMail Scale" implies highly-interactive single page web applications with a lot of functionality, to me.
Post reply on HN