mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-18 13:43:49 +01:00
9c9a69f2e2
This adds a way to dynamically change the static RAM limit of a script, which is also its current RAM usage. This makes it possible for scripts to dynamically change their memory footprint, opening up new strategies beyond current ram-dodging. Calling functions still permanently increases the *dynamic* memory limit; RAM-dodging is still the optimal strategy for avoiding RAM costs, in that sense. This also adds dynamicRamUsage to the info returned by `getRunningScript`, to allow introspection on the currently needed ram.
35 lines
1.2 KiB
Markdown
35 lines
1.2 KiB
Markdown
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
|
|
[Home](./index.md) > [bitburner](./bitburner.md) > [NS](./bitburner.ns.md) > [ramOverride](./bitburner.ns.ramoverride.md)
|
|
|
|
## NS.ramOverride() method
|
|
|
|
Change the current static RAM allocation of the script.
|
|
|
|
**Signature:**
|
|
|
|
```typescript
|
|
ramOverride(ram?: number): number;
|
|
```
|
|
|
|
## Parameters
|
|
|
|
| Parameter | Type | Description |
|
|
| --- | --- | --- |
|
|
| ram | number | _(Optional)_ The new RAM limit to set. |
|
|
|
|
**Returns:**
|
|
|
|
number
|
|
|
|
The new static RAM limit, which will be the old one if it wasn't changed. This means you can use no parameters to check the current ram limit.
|
|
|
|
## Remarks
|
|
|
|
RAM cost: 0 GB
|
|
|
|
This acts analagously to the ramOverride parameter in runOptions, but for changing RAM in the current running script. The static RAM allocation (the amount of RAM used by ONE thread) will be adjusted to the given value, if possible. This can fail if the number is less than the current dynamic RAM limit, or if adjusting upward would require more RAM than is available on the server.
|
|
|
|
RAM usage will be rounded to the nearest hundredth of a GB, which is the granularity of all RAM calculations.
|
|
|