Skip to content

Commit 2d489fb

Browse files
committed
Made a named and documented variable for all memory limits in MediaMachine.
1 parent e959db7 commit 2d489fb

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Source/DFPSR/api/mediaMachineAPI.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,15 @@ static ReadableString getMediaTypeName(DataType type) {
4646
}
4747
}
4848

49+
// An upper limit on the memory makes sure that the entire application does not crash from getting bottomless recursion in a virtual machine.
50+
static const int32_t MEMORY_LIMIT = 1024;
51+
4952
class MediaMemory : public PlanarMemory {
5053
public:
5154
MemoryPlane<FixedPoint> FixedPointMemory;
5255
MemoryPlane<AlignedImageU8> AlignedImageU8Memory;
5356
MemoryPlane<OrderedImageRgbaU8> OrderedImageRgbaU8Memory;
54-
MediaMemory() : FixedPointMemory(1024), AlignedImageU8Memory(1024), OrderedImageRgbaU8Memory(512) {}
57+
MediaMemory() : FixedPointMemory(MEMORY_LIMIT), AlignedImageU8Memory(MEMORY_LIMIT), OrderedImageRgbaU8Memory(MEMORY_LIMIT) {}
5558
void store(int32_t targetStackIndex, const VMA& sourceArg, int32_t sourceFramePointer, DataType type) override {
5659
switch(type) {
5760
case DataType_FixedPoint:

0 commit comments

Comments
 (0)