ArrayList and PImage Out Of Memory, Can anyone help me please ?
in
Programming Questions
•
1 month ago
I'm trying to reproduce a webcam live stream with delay.
Actually, it works, but i run out of memory very fast.
Every 50 last frames are saved into an Array List.
When the arrayList size is over 50, i remove the first index.
I rapidly run out of memory.
Im pretty sure that when i remove an index, it doesnt delete the PImage from the memory.
Anynone can help me?
Actually, it works, but i run out of memory very fast.
Every 50 last frames are saved into an Array List.
When the arrayList size is over 50, i remove the first index.
I rapidly run out of memory.
Im pretty sure that when i remove an index, it doesnt delete the PImage from the memory.
Anynone can help me?
- void draw() {
- if (cam.available() == true) {
- cam.read();
- proc.add(cam.get());
- image(proc.get(proc.size()-1),0,0);
- if(proc.size()>=49)
- {
- image(proc.get(20),0,0);
- image(proc.get(25),0,0);
- image(proc.get(30),0,0);
- image(proc.get(35),0,0);
- image(proc.get(40),0,0);
- image(proc.get(45),0,0);
- }
- if(proc.size() >= 50){
- proc.remove(0);
- }
- }
- }
1