EngineStreamingSetMemorySize: Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
No edit summary |
||
(2 intermediate revisions by 2 users not shown) | |||
Line 7: | Line 7: | ||
==Syntax== | ==Syntax== | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
nil engineStreamingSetMemorySize( | nil engineStreamingSetMemorySize( int sizeBytes ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
{{OOP||[[EngineStreaming]]:setMemorySize|memorySize|engineStreamingGetMemorySize}} | {{OOP||[[EngineStreaming]]:setMemorySize|memorySize|engineStreamingGetMemorySize}} | ||
Line 19: | Line 19: | ||
addCommandHandler("ssms", function(_, sizeMB) | addCommandHandler("ssms", function(_, sizeMB) | ||
if tonumber(sizeMB) then | if tonumber(sizeMB) then | ||
outputChatbox("The maximum streaming memory available has been changed from " .. math.floor( | outputChatbox("The maximum streaming memory available has been changed from " .. math.floor(engineStreamingGetMemorySize() / 1024 / 1024) .. " MB to " .. sizeMB .. " MB") | ||
engineStreamingSetMemorySize(tonumber(sizeMB) * 1024 * 1024) -- Convert MB to Bytes | engineStreamingSetMemorySize(tonumber(sizeMB) * 1024 * 1024) -- Convert MB to Bytes | ||
else | else | ||
Line 26: | Line 26: | ||
end, false, false) | end, false, false) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
==See Also== | ==See Also== | ||
{{Engine functions}} | {{Engine functions}} |
Latest revision as of 16:44, 9 December 2024
Sets the maximum amount of RAM [in bytes] that can be used for streaming
Tip: The `showmemstat` command can be used to see this value in real-time [You might have to scroll down using PgDown on your keyboard] |
Tip: To restore to default value use engineStreamingRestoreMemorySize |
Important Note: This function is meant for advanced users only, as it can lead to stability issues. Using a very high value might result in more crashes, while using a value too low might lead to frequent pop-in [and due to the way MTA works micro-stutter as well] |
Syntax
nil engineStreamingSetMemorySize( int sizeBytes )
OOP Syntax Help! I don't understand this!
- Method: EngineStreaming:setMemorySize(...)
- Variable: .memorySize
- Counterpart: engineStreamingGetMemorySize
Required Arguments
- sizeBytes : The maximum amount of RAM [in bytes] that can be used for streaming. Must be a positive non-zero number.
Example
This example adds a command that can be used to change the streaming memory size, and display the previous value.
addCommandHandler("ssms", function(_, sizeMB) if tonumber(sizeMB) then outputChatbox("The maximum streaming memory available has been changed from " .. math.floor(engineStreamingGetMemorySize() / 1024 / 1024) .. " MB to " .. sizeMB .. " MB") engineStreamingSetMemorySize(tonumber(sizeMB) * 1024 * 1024) -- Convert MB to Bytes else outputChatbox("Please enter a numeric value!") end end, false, false)
See Also
- engineAddImage
- engineApplyShaderToWorldTexture
- engineFreeModel
- engineGetModelFlags
- engineGetModelIDFromName
- engineGetModelLODDistance
- engineGetModelNameFromID
- engineGetModelPhysicalPropertiesGroup
- engineGetModelTextureNames
- engineGetModelTextures
- engineGetModelTXDID
- engineGetModelVisibleTime
- engineGetObjectGroupPhysicalProperty
- engineGetSurfaceProperties
- engineGetVisibleTextureNames
- engineImageGetFilesCount
- engineImageGetFiles
- engineImageGetFile
- engineImageLinkDFF
- engineImageLinkTXD
- engineImportTXD
- engineLoadCOL
- engineLoadDFF
- engineLoadIMG
- engineLoadIFP
- engineLoadTXD
- engineRemoveImage
- engineRemoveShaderFromWorldTexture
- engineReplaceAnimation
- engineReplaceCOL
- engineReplaceModel
- engineRequestModel
- engineResetModelFlags
- engineResetModelLODDistance
- engineResetSurfaceProperties
- engineRestoreAnimation
- engineRestoreCOL
- engineRestoreDFFImage
- engineRestoreModel
- engineRestoreModelPhysicalPropertiesGroup
- engineRestoreObjectGroupPhysicalProperties
- engineRestoreTXDImage
- engineRestreamWorld
- engineSetAsynchronousLoading
- engineSetModelFlag
- engineSetModelFlags
- engineSetModelLODDistance
- engineSetModelPhysicalPropertiesGroup
- engineSetModelVisibleTime
- engineSetObjectGroupPhysicalProperty
- engineSetSurfaceProperties
- engineStreamingFreeUpMemory
- engineStreamingGetUsedMemory