class object_pager

Management for IO buffering.

You do not need to instantiate this class: all members are static.

object_pager Details

class cs.object_pager

Management for IO buffering.

static get_capacity()

Get the number of bytes of managed objects that can be kept in memory.

Return type:int
Returns:The number of bytes of managed objects that can be kept in memory at any time.
>>> object_pager.get_capacity()
268435456
static get_current_io_buffer_capacity()

Get the number of bytes currently allocated for IO buffering.

Return type:int
Returns:The number of bytes currently allocated for IO buffering.
Raises:result.ERROR_SDG_NOT_PRESENT if no allocation has been done.
>>> object_pager.get_current_io_buffer_capacity()
134217728
static get_pending_io_buffer_capacity()

Get the IO buffer capacity specified in the last object_pager.set_io_buffer_capacity() call.

Return type:int
Returns:The number of bytes allocated for IO buffering.
>>> object_pager.get_pending_io_buffer_capacity()
134217728
static set_capacity(s)

Alter the number of bytes of managed objects that can be kept in memory.

Parameters:s (int) – The number of bytes of managed objects that can be kept resident.
Return type:NoneType

A reasonable setting might be 1024*1024*256. This should probably not exceed 0.75 * min(RAM_SIZE,2GB). Setting this value too low can cause thrashing, but might be desirable if your algorithm has good access patterns or needs to use the memory for other purposes.

If called with a value less than the current number of bytes in use by resident objects, then objects will be paged out immediately.

# Side effects from this example may affect the behavior of other examples.
>>> print("capacity: ", object_pager.get_capacity())
capacity:  268435456
>>> object_pager.set_capacity(200000000)
>>> print("capacity: ", object_pager.get_capacity())
capacity:  200000000
static set_io_buffer_capacity(s)

Set the number of bytes to allocate for IO buffering.

Parameters:s (int) – The number of bytes to allocate for IO buffering.
Return type:NoneType

A reasonable setting might be 1024*1024*128: 268435456

  • Too low a value may cause thrashing.
  • Too high a value may cause the tool to exhaust virtual address space.

The new value does not take effect until the next time project::load() is called.

# Side effects from this example may affect the behavior of other examples.
>>> object_pager.set_io_buffer_capacity(100000000)
>>> print('current: ', object_pager.get_current_io_buffer_capacity())
current:  134217728
>>> print('pending: ', object_pager.get_pending_io_buffer_capacity())
pending:  100000000