Method: Cuboid::System::Slots#unallocated_memory

Defined in:
lib/cuboid/system/slots.rb

#unallocated_memoryInteger

Returns Amount of memory (in bytes) available for future scans.

Returns:

  • (Integer)

    Amount of memory (in bytes) available for future scans.



93
94
95
96
97
98
99
100
101
102
103
104
# File 'lib/cuboid/system/slots.rb', line 93

def unallocated_memory
    # Available memory right now.
    available_mem = @system.memory_free

    # Remove allocated memory to figure out how much we can really spare.
    @pids.each do |pid|
        # Mark the remaining allocated memory as unavailable.
        available_mem -= remaining_memory_for( pid )
    end

    available_mem
end