- Home /
Unity5 filled my SSD?
Hello everyone, I had a weird issue using Unity5 on mac (Yosemite). I was running a scene that queries a plugin almost every frame and use a WebcamTesture. When the application was running for 5 minutes Unity allerted me that there wasn't enought space on disk to continue the task and it shutted down. The odd stuff is that I never write on disk (SSD) in my script. So something filled 33GB of memory in about 5 minutes.
Can someone help me to understand what could be the error?
thank you.
"I was running a scene that queries a plugin almost every frame and use a WebcamTesture"
What does the plugin do? What are you doing with the webcam texture? Can you disable one or the other to figure out which is responsible, or are they interdependent?
Unity does not write excessive amounts of data like this unless you ask it to. Something you or this plugin is doing is responsible. Please answer these questions and show us some code so we have something to look at.
What does the plugin do? The plugin that I'm using is a class that try to detect faces using OpenCV.
What are you doing with the webcam texture? I'm getting an handler of the webcam texture that is passed to the plugin and the texture is rendered on a Plane.
Can you disable one or the other to figure out which is responsible, or are they interdependent? I tryed every combination but I can't figure out what the problem is.
Here is the code in c#
void Update () {
if(!webcamReady) return;isExecuting = true; pixels = webcamTexture.GetPixels32(); pixelsHandle = GCHandle.Alloc(pixels, GCHandleType.Pinned); webcamWidth = webcamTexture.width; webcamHeight = webcamTexture.height; $$anonymous$$arshal.PtrToStringAuto(faceDetection(pixelsHandle.AddrOfPinnedObject(), webcamWidth, webcamHeight)); gameObject.GetComponent<SpriteRenderer>().material.mainTexture = webcamTexture; }
This is the c++ code:
const char * faceDetection( char * data , int width , int height, int i)
{
Debug("Facedetection start");
string s_faces_coord_X;
string s_faces_coord_Y;
string s_centerWidth;
string s_centerHeight;
string facesCoordinates = "";
string empty = "emptyData";
//Vector of Rects.
std::vector<Rect> faces;
IplImage * p = cvCreateImageHeader ( cvSize ( width , height ), IPL_DEPTH_8U , 4 );
cvSetData ( p , data , p -> widthStep );
$$anonymous$$at frame = cvarrTo$$anonymous$$at(p);
$$anonymous$$at frame_gray;
flip(frame,frame,0);
cvtColor(frame, frame_gray, COLOR_BGR2GRAY );
equalizeHist( frame_gray, frame_gray );
Debug("Detect Face $$anonymous$$ultiscale");
face_cascade.detect$$anonymous$$ultiScale( frame_gray, faces, 1.1, 2, 0, Size(120, 120) );
for( size_t i = 0; i < faces.size(); i++ )
{
// Do something with face
}
cvReleaseImageHeader ( & p );
const char * facecoord;
if (facesCoordinates.size() != 0)
facecoord = facesCoordinates.data();
else
facecoord = empty.data();
return facecoord;
}
Your answer
Follow this Question
Related Questions
C++ plugin for Unity “EntryPointNotFoundExeption” 0 Answers
Multiple Cars not working 1 Answer
Windows Universal IAP 0 Answers
C++ Plugin for mipmapping and JPG encoding: viability 0 Answers
Communication between Unity and Arduino Yun via WiFI 1 Answer