diff options
| author | nasr <nsrddyn@gmail.com> | 2025-11-28 21:25:58 +0100 |
|---|---|---|
| committer | nasr <nsrddyn@gmail.com> | 2025-11-28 21:25:58 +0100 |
| commit | eb08ce6d690852c99c576cc1216687c569df359e (patch) | |
| tree | 8a23f3d30528164d83e892664dc2850830cfa3cd /src | |
| parent | b01b0586a839cc0d36274489f13bf77eea065897 (diff) | |
feature: creating a large data object
Diffstat (limited to 'src')
| -rw-r--r-- | src/main/scala/main/domain/MemoryOperations.scala | 31 |
1 files changed, 20 insertions, 11 deletions
diff --git a/src/main/scala/main/domain/MemoryOperations.scala b/src/main/scala/main/domain/MemoryOperations.scala index 464d0bc..eb9649b 100644 --- a/src/main/scala/main/domain/MemoryOperations.scala +++ b/src/main/scala/main/domain/MemoryOperations.scala @@ -3,30 +3,39 @@ package main.domain import main.services._ import scala.util.hashing -import scala.util.hashing.MurmurHash3 -import scala.math._ +import scala.util.hashing.MurmurHash3 import scala.math._ import scala.collection.immutable.ListSet -import scala.collection.mutable.ArrayBuffer +import java.nio.ByteBuffer /** * * Large memory object to allocate on the heap * This is an implementation by me + * A method to do this bassically an Array with large bytes allocated to it * * */ -sealed Trait MemoryObject { - +class MemoryObject { + + object size { + val size: Int = 10 * 1024 * 1024 + } + + val buffer: Vector[size.type] = Vector(1, 1) } -class MemoryAllocater { - /* - * - * for stressing the memory we want to do some heavy heap allocations back and forth - * - * */ + +/* + * Using java.nio.ByteBuffer + * Allocate memory then free memory + * for stressing the memory we want to do some heavy heap allocations back and forth + * + * + * */ + +class MemoryAllocater extends ByteBuffer { def run(): Unit = println("stressing memory") |
