How can I specify the maximum amount of heap an RT

2019-07-15 10:55发布

We are creating a Real-Time Process in VxWorks 6.x, and we would like to limit the amount of memory which can be allocated to the heap. How do we do this?

标签: vxworks
2条回答
我只想做你的唯一
2楼-- · 2019-07-15 11:30

This can be done through the use of the HEAP_MAX_SIZE environment variable. If it is set, it limits the ability of the heap to grow beyond that size. It does not, however, limit the initial heap size.

See page 31

查看更多
乱世女痞
3楼-- · 2019-07-15 11:35

When creating a RTP via rtpSpawn(), you can specify an environment variable which controls how the heap behaves.
There are 3 environment variables:

HEAP_INITIAL_SIZE - How much heap to allocate initially (defaults to 64K)  
HEAP_MAX_SIZE     - Maximum heap to allocate (defaults to no limit)
HEAP_INCR_SIZE    - memory increment when adding to RTP heap (defaults to 1 virtual page)

The following code shows how to use the environment variables:

   char * envp[] = {"HEAP_INITIAL_SIZE=0x20000", "HEAP_MAX_SIZE=0x100000", NULL);
   rtpSpawn ("myrtp.vxe", NULL, envp, 100, 0x10000, 0, 0);

查看更多
登录 后发表回答