Skip to content

Commit 1c87bbf

Browse files
switch to ps_malloc
1 parent 0f83225 commit 1c87bbf

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

src/eloquent_esp32cam/camera/rgb_565.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ namespace Eloquent {
9999
length = width * height;
100100

101101
ESP_LOGI("Camera", "Allocating %d bytes for %dx%d RGB565 image", length * 2, width, height);
102-
data = (uint16_t*) malloc(length * 2);
102+
data = (uint16_t*) ps_malloc(length * 2);
103103
}
104104

105105
if (data == NULL)

src/eloquent_esp32cam/jpeg/decoder_gray.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ namespace Eloquent {
9595

9696
if (gray.pixels == NULL) {
9797
ESP_LOGI("JPEG", "Allocating memory for decoding");
98-
gray.pixels = (uint8_t*) malloc(camera.resolution.getWidth() / 8 * camera.resolution.getHeight() / 8);
98+
gray.pixels = (uint8_t*) ps_malloc(camera.resolution.getWidth() / 8 * camera.resolution.getHeight() / 8);
9999
}
100100

101101
benchmark.start();

src/eloquent_esp32cam/motion/detection.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ namespace Eloquent {
112112

113113
// first frame, only copy frame to prev
114114
if (_prev == NULL) {
115-
_prev = (uint16_t*) malloc(camera.rgb565.length * sizeof(uint16_t));
115+
_prev = (uint16_t*) ps_malloc(camera.rgb565.length * sizeof(uint16_t));
116116
copy(camera.rgb565);
117117

118118
return exception.set("First frame, can't detect motion").soft();

src/eloquent_esp32cam/motion/roi_detection.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ namespace Eloquent {
8484
return exception.set("You MUST set a width and height for the RoI");
8585

8686
if (_prev == NULL) {
87-
_prev = (uint8_t*) malloc(_w * _h * sizeof(uint16_t));
88-
_roi = (uint8_t*) malloc(_w * _h * sizeof(uint16_t));
87+
_prev = (uint8_t*) ps_malloc(_w * _h * sizeof(uint16_t));
88+
_roi = (uint8_t*) ps_malloc(_w * _h * sizeof(uint16_t));
8989
copy(frame, _prev);
9090

9191
return exception.set("First frame, can't detect motion").soft();

0 commit comments

Comments
 (0)