# rxvt-unicode  - reducing memory usage



## copypaiste (Dec 28, 2011)

Hi, folks!

When each new urxvt starts it opens two processes - one of current user id and the other with root id. Is it that really necessary to consume twice the memory?  I suppose this behavior implements some features which require root privileges, i.e making login records. Any hints to reduce memory consumptions?


----------



## SirDice (Dec 28, 2011)

copypaiste said:
			
		

> When each new urxvt starts it opens two processes - one of current user id and the other with root id. Is it that really necessary to consume twice the memory?


While it may look that way it's not using twice the memory.



> Any hints to reduce memory consumptions?


Yes, don't make the scrollback buffer too large. This is what consumes most of the memory.


----------



## copypaiste (Dec 28, 2011)

SirDice said:
			
		

> While it may look that way it's not using twice the memory.



You mean it's a shared memory?


----------



## SirDice (Dec 28, 2011)

copypaiste said:
			
		

> You mean it's a shared memory?



Yes.


----------



## copypaiste (Dec 28, 2011)

Ok, but how can you determine it's shared? Some "ps" wizardry?


----------



## SirDice (Dec 28, 2011)

Good question and one I don't have an answer for :e

As far as I know it's because of vfork(2) which spawns a new process but copies the parent's memory.

If you want to limit *urxvt*'s memory even further you can look into running it in client/server mode.

See urxvtd(1) and urxvtc(1).


----------



## copypaiste (Dec 28, 2011)

SirDice said:
			
		

> Good question and one I don't have an answer for :e
> 
> As far as I know it's because of vfork(2) which spawns a new process but copies the parent's memory.


Ok, it's a theme for another topic already. 
The 'root' process is a child, we can see it in "ps -j" output. But what tools should we use in FreeBSD to determine shared memory allocations (ipcs is for sysV only)? DTrace is the only thing that comes to my mind. Ideas?



			
				SirDice said:
			
		

> If you want to limit *urxvt*'s memory even further you can look into running it in client/server mode.


Thanks, I'm aware of these features.


----------



## SirDice (Dec 28, 2011)

Shared memory and/or IPC doesn't necessarily imply System V


----------



## copypaiste (Dec 28, 2011)

Btw, *truss* shows no signs of vfork, a usual fork is called.


----------

