Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

pmap shows that Dropbox uses nearly 200MB of memory (on Linux). When I run Dropbox on Windows, it only uses about 30MB of memory. What is the reason for that?

Also, why are there so many [ anon ] ranges that occupy so much memory according to pmap output?

[mirror@home Dropbox]$ pgrep dropbox
9544

9544:   /home/mirror/.dropbox-dist/dropbox
08048000   3028K r-x--  /home/mirror/.dropbox-dist/dropbox
0833d000    248K rw---  /home/mirror/.dropbox-dist/dropbox
0837b000     52K rw---    [ anon ]
08c20000  15688K rw---    [ anon ]
ad052000   1028K rw---    [ anon ]
ad1d4000   1024K rw---    [ anon ]
ad3d4000   1024K rw---    [ anon ]
ad5d4000      4K -----    [ anon ]
ad5d5000  10240K rw---    [ anon ]
adfd5000      4K -----    [ anon ]
adfd6000  10240K rw---    [ anon ]
ae9d6000      4K -----    [ anon ]
ae9d7000  10240K rw---    [ anon ]
af3d7000      4K -----    [ anon ]
af3d8000  10240K rw---    [ anon ]
afdd8000      4K -----    [ anon ]
afdd9000  10240K rw---    [ anon ]
b07d9000      4K -----    [ anon ]
b07da000  10240K rw---    [ anon ]
b11da000      4K -----    [ anon ]
b11db000  10240K rw---    [ anon ]
b1bdb000      4K -----    [ anon ]
b1bdc000  10240K rw---    [ anon ]
b25dc000      4K -----    [ anon ]
b25dd000  10240K rw---    [ anon ]
b2fdd000      4K -----    [ anon ]
b2fde000  10240K rw---    [ anon ]

........

b7fc6000      4K rw---  /lib/libpthread-2.5.so
b7fc7000     12K rw---    [ anon ]
b7fca000      4K r-x--  /home/mirror/.dropbox-dist/_bisect.so
b7fcb000      4K rw---  /home/mirror/.dropbox-dist/_bisect.so
b7fcc000     20K r-x--  /home/mirror/.dropbox-dist/_struct.so
b7fd1000      4K rw---  /home/mirror/.dropbox-dist/_struct.so
b7fd2000    108K r-x--  /lib/ld-2.5.so
b7fed000      4K r----  /lib/ld-2.5.so
b7fee000      4K rw---  /lib/ld-2.5.so
bfa77000    156K rw---    [ stack ]
 total   194620K
share|improve this question

pmap displays the virtual memory of a process – that is, not only locations where the process stores data and stack, but also dynamically loaded libraries, memory-mapped files, shared memory, and so on. Very few of those actually contribute to the resident or shared segments, which would represent actual resource usage.

In other words, you are looking at the wrong numbers. For "memory usage", look at the "RSS" field in ps, or "RES" in top/htop.

For example, Dropbox on my system is about 38 MB, even though its virtual memory space is over 1.7 GB.

share|improve this answer
    
what is virtual memory? physical memory + swap space? – hugemeow Sep 6 '12 at 18:41
2  
@hugemeow: No – it's the memory address space of a process. (Processes cannot access RAM or swap directly – they can only access "virtual" addresses, which the kernel translates to RAM/swap belonging to that process, RAM/swap belonging to shared libraries, data in a mmap()ed file, or something else. Every process has a separate virtual address space of its own.) – grawity Sep 6 '12 at 18:55
    
so is there a lot of parts that constitue process's memory, for example stack, heap, shared space(which can be used by many process, right?) – hugemeow Sep 6 '12 at 19:03
    
@hugemeow: Right. (Other parts are the "code" (the program itself), various kinds of "memory-mapped files", and probably some other parts that I forget.) Only some parts actually "use" your RAM/swap. – grawity Sep 6 '12 at 19:12

According to https://www.dropbox.com/en/help/144

Want more details? Dropbox stores metadata on your files in RAM to prevent constant and expensive database lookups while syncing. The metadata includes paths to files in your Dropbox, checksums, modification times, etc.

We are working hard on making this information more compact and are working on several fronts to improve memory usage. Our techniques are not limited to rewriting pieces of our source code and writing custom memory allocators.

Still, on my computer the RES of dropbox is 150MB+ (according to top). My dropbox contains 4261 files+folders, resulting in 36KB per file... The raw data they mention shouldn't use more than about 200bytes per file. Of course, data structures can have significant overhead.

Just for fun I checked the memory usage of python storing a dictionary of the files in my dropbox folder:

import os
files = { f[0]: (f[0], (1,2,3,4,5), 1, 1) for f in os.walk(".") }

This gives a RSS of 9.6MB

This is very simplified of course, but it seems unlikely that dropbox is doing a very good job keeping a low memory footprint.

PS: This does not seem to be a linux client issue: https://www.dropboxforum.com/hc/en-us/community/posts/204452623-Memory-Usage-Disproportionate-to-Dropbox-Contents

Hi, I'm using Dropbox on Windows7 64bit and am using it to keep just over 500KB over about 200 files synced across my devices.

Anyway, the Dropbox client consistently runs, using 95MB of RAM, which I think is a little unreasonable.

share|improve this answer

I also noticed that Dropbox was using almost all available memory on Linux Mint 17.1.

I saw this when I opened System Monitor, clicked the "Processes" tab, and clicked the top of the "Memory" column to sort by largest memory usage.

This worked for me, but read the warning below first:

sudo chmod 777 -R ~/Dropbox

After I ran this, Dropbox was able to sync several files that had not synced before. Then I rebooted the machine, and the problem was fixed.

Warning: If you saved config files to Dropbox that have permissions other than 777, restoring those files with altered permissions may break things. You can find ways to save and restore file permissions if that is a concern. At least copy the original file to a different file name before restoring the Dropbox version. Then you will know what the original permissions were if something breaks.

share|improve this answer
2  
Note that this opens up any files in that directory to reading and writing by ANYONE on your system. That's fine if this is a single-user system, but catastrophically awful if your system allows other users. – ChrisInEdmonton Feb 20 at 15:40

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.