c++ - Dynamical Memory Allocation / Making use of unused memory -


i'm going write application needs lot of memory dynamically. of memory used caching purposes , used speed ups. parts freed on demand.

unfortunately kernel kill process if runs out of memory. free memory. want similar linux page cache explained here. possible implement such behaviour in userspace in convenient way?

i'm thinking implementing such cache "cache files" stored on ramfs/tmpfs memory mapped file io, i'm sure, there more comfortable way.

thanks in advance!

yes should possible. kernels have memory alloc method process sleeps until gets requested memory. ( kernels ive worked have). if yours doesnt may time implement one. check out kmem functions in linux. passive way of doing youve asked. process waiting until else frees memory. if want free memory own process address space when theres no memory, can done user space. need keep journal of allocated memory , free ones dont need on demand when alloc fails.


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -