Re: Forcing Deallocation of Memory?

Bryn Paul Arnold Jones (bpaj@gytha.demon.co.uk)
Sat, 6 Jun 1998 11:50:52 +0100 (BST)


-----BEGIN PGP SIGNED MESSAGE-----

On Fri, 5 Jun 1998, Phil's Kernel Account wrote:

> Okay, I've got AccelX 4.1 (yeah, yeah. SHADDYUP. SuSE's Permedia2 server
> is an unusable piece of shit, and I hope they hear me saying this.:P), and
> I've run into this ANNOYING problem..
>
> It doesn't dealloc memory. Ever.

This problem is not restricted to that perticular X server, tho some may
be worse than others ...

> Which makes leaving it up for more than a
> few hours fatal. I only have 64M (somebody wanna send me a 64M SDRAM
> DIMM?:) in this box, and 32M swap (I don't wanna repartition;). What's it
> doing? I'm not entirely sure. Looks to me like it's sizing up everything
> you run, then adding IT'S memory into it's own.
>

The X server needs memory to hold state information as it talks to the
xapp, and needs to allocate an ammount of space to hold the data required
to display the app...

> Now, is there a FEASABLE way that we could do forced deallocation by PID
> and/or memaddr in the kernel? By feasable, I mean it doesn't trash
> everything when it does it, and only forces the dealloc if the matching
> PID is dead.

No. Which bit of memory is free? The malloc implimentation is free to
grab more memory than it needs to satsfy the allocation request that
prompted it to get memory (well it get's virtual address space, but that's
not really an issue). It can then use the block as a pool to satisfy
subsquent requests, and reuse memory which has been released.

The only thing you can do is let it swap, any page that's not used will
stay permenently on the swap device. If you really don't want to
re-partition your disks, make a swapfile, and use that:

dd if=/dev/zero of=/some/path/swapfile bs=1k count=32k

will create a 32 Mb swapfile, you can the mkswap /some/path/swapfile and
swapon /some/path/swapfile like normal. You might want to put it at a
lower priority than your swap partition, if so see swapon(8).

> Because the way I *PREFER* to run X, I'll need to upgrade
> this box to the full 1G to keep X going. ;P
>

Bryn
PS if you make a swapfile, don't forget to put it in your fstab ...
- --
PGP Pub key http://www.gytha.demon.co.uk/pubkey.asc ID: 1024/30AF2D69
On-line, adj.: FP: FC 4E 41 9E 64 C3 AB 28 A3 5A 57 F8 CC D9 A7 B8
The idea that a human being should always be accessible to a computer.

-----BEGIN PGP SIGNATURE-----
Version: 2.6.3i
Charset: noconv
Comment: Probably (spelt 'Proberbly') requires PGP version 2.6 or later ;)

iQCVAwUBNXkfEOsaGi8wry1pAQF/PAP/TDBb61jwmqPoUdVpjB8yaLXxTexMYdRn
entFA9eowQfW7rLnZenFOe0HitYWfGBoqJAj+mIjkzr3n24mS/bULmJaFXnopWMo
CCU9wv+chNx/KXsAm0K0pz/DpK6Pxp1g2cjxeywophByeUmgx4m+jduiYvK+ntyi
pzC18zW0U5o=
=FRul
-----END PGP SIGNATURE-----

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu