Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3988702
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T06:17:02+00:00 2026-05-20T06:17:02+00:00

im writing a video recorder application for mac with cocoa, and have a huge

  • 0

im writing a video recorder application for mac with cocoa, and have a huge problem with memory usage.

When launching the app, i have a window with two buttons that i can change view with and a simple custom view where the webcam get loaded. Just this view takes 21mb of ram, when i press on one of the buttons i change the custom view to a QTMovie of the content recorded from the cam.

Every time i change view my app fills upp with about 10mb of ram, and never stops. I have garbage collection on. Even if I show the view of the QTMovie and wants to press the button to display it again, its takes more ram.

Code that loads the subview, trigged from the button

 if ([myCurrentViewController view] != nil)
    [[myCurrentViewController view] removeFromSuperview];



        NSViewController* cameraViewController2 = [[NSViewController alloc] initWithNibName:@"kVideo" bundle:nil];
        if (cameraViewController2 != nil)
        {
            myCurrentViewController = cameraViewController2;    
        }


[myTargetView addSubview: [myCurrentViewController view]];

And this is what happens when the the videoView loads, and this takes 10mb of ram every time i want it to display.

-(void)playMovie
{

[movieView setMovie:nil];

NSString* moviePath = [NSBundle pathForResource:@"tempFile" ofType:@"mov" inDirectory:@"/Users/Shared/"];
QTMovie* movie = [[QTMovie alloc] initWithFile:moviePath error:nil];


[movieView setMovie:movie]; 

}

- (void)awakeFromNib
{    

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(receiveEvent3:) name:@"updateVideoPlayer" object:nil];

[self playMovie];
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T06:17:02+00:00Added an answer on May 20, 2026 at 6:17 am

    Okay i solved it, every time i pressed a button to change a view, i allocated the new view with something like this SViewController* cameraViewController2 = [[NSViewController alloc] initWithNibName:@"kVideo" bundle:nil];, and they never got released or thrown away or whatever they should do. Now instead i allocate my views in one place, and just refer to the allocated views when i press new buttons.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am writing an Android application in which I'll have to create a video
I am writing a Mac application that plays the streaming video. I'll use Media
I am writing a video streaming server application. I have an AVI file and
I am writing an application that exports video that I have captured (PAL SDI).
I am writing a Windows Phone application with ability to play video. I have
I'm writing GWT application where I need to upload video file and encode that
I'm writing an Android app where users can upload video to Youtube. I'd like
Writing a test app to emulate PIO lines, I have a very simple Python/Tk
I'm writing a web app that serves H.264 encoded MP4 video. In Chrome and
I am writing a WPF application and need to show info about video card

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.