Products
Features
YouTube Video Summarizer
Summarize YouTube videos
Web & PDF Highlighter
Highlight web pages & PDFs
Chat with PDF
Ask any PDF questions with AI
Ask AI Clone
Chat with your highlights & memories
Audio Transcriber
Transcribe audio files to text
Glasp Reader
Read and highlight articles
Kindle Highlight Export
Export your Kindle highlights
Idea Hatch
Hatch ideas from your highlights
Integrations
Obsidian Plugin
Notion Integration
Pocket Integration
Instapaper Integration
Medium Integration
Readwise Integration
Snipd Integration
Hypothesis Integration
Apps & Extensions
Chrome Extension
Safari Extension
Edge Add-ons
Firefox Add-ons
iOS App
Android App
Discover
Discover
Ideas
Discover new ideas and insights
Articles
Curated articles and insights
Books
Book recommendations by great minds
Posts
Essays and notes from readers
Quotes
Inspiring quotes collection
Videos
Curated videos and summaries
Explore Glasp
Glasp Newsletter
Weekly insights and updates
Glasp Talk
Interview series with great minds
Glasp Blog
Latest news and articles
Glasp Use Cases
Learn how others use Glasp
Build & Support
Glasp API
Access Glasp's API for developers
MCP Connector
Connect Glasp to Claude & ChatGPT
Community
Glasp Reddit Community
Students
Student discount and benefits
FAQs
Frequently Asked Questions
AboutPricing
DashboardLog inSign up

The NEW Keyword in C++

225.9K views
•
September 1, 2017
by
The Cherno
YouTube video player
The NEW Keyword in C++

TL;DR

The "new" keyword in C++ is used to dynamically allocate memory on the heap and is important for managing memory and optimizing performance.

Transcript

hey what's up guys my name is HMO and welcome back to my state plus plus series today we'll be told me all about the new keyword it's a boss boss and man man does this meet talking about if you guys missed my video yesterday about how to create objects in C++ and the correct way to accentuate objects and definitely check that out cod that link ther... Read More

Key Insights

  • 👶 The "new" keyword in C++ is used to dynamically allocate memory on the heap.
  • 👶 Understanding the "new" keyword is important for managing memory and optimizing performance in C++ programs.
  • 👶 The "new" keyword not only allocates memory but also calls the constructor of the allocated object.
  • 👤 It is necessary to use the "delete" keyword to release the allocated memory and prevent memory leaks.
  • 👶 The use of the "new" keyword should be paired with the "delete" keyword to properly manage memory in C++ programs.
  • ⬛ Using "new" with square brackets allows for the allocation of arrays, which should be freed using "delete[]" with square brackets.
  • 👶 Placement new allows for the initialization of objects in specific memory addresses.

Install to Summarize YouTube Videos and Get Transcripts

Explore YouTube Video Summarizer or Get YouTube Transcript Extractor

Questions & Answers

Q: Why is it important to understand the "new" keyword in C++?

Understanding the "new" keyword is important in C++ because it allows for dynamic memory allocation and is essential for controlling memory usage and optimizing performance in programs.

Q: How does the "new" keyword work when allocating memory?

When using the "new" keyword, it requests a specific amount of memory from the operating system. It then returns a pointer to the allocated memory, allowing for the storage and retrieval of data.

Q: What is the difference between using "new" to allocate memory and using malloc() in C++?

The "new" keyword not only allocates memory but also calls the constructor of the object being allocated. malloc(), on the other hand, only allocates memory and does not call any constructors. It is generally recommended to use the "new" keyword in C++.

Q: Why is it necessary to use the "delete" keyword after using "new" to allocate memory?

When memory is allocated using "new", it is not automatically released. The "delete" keyword must be used to free the allocated memory and mark it as available for use again. Failure to do so can result in memory leaks.

Key Insights:

  • The "new" keyword in C++ is used to dynamically allocate memory on the heap.
  • Understanding the "new" keyword is important for managing memory and optimizing performance in C++ programs.
  • The "new" keyword not only allocates memory but also calls the constructor of the allocated object.
  • It is necessary to use the "delete" keyword to release the allocated memory and prevent memory leaks.
  • The use of the "new" keyword should be paired with the "delete" keyword to properly manage memory in C++ programs.
  • Using "new" with square brackets allows for the allocation of arrays, which should be freed using "delete[]" with square brackets.
  • Placement new allows for the initialization of objects in specific memory addresses.
  • Understanding and utilizing the "new" keyword correctly can greatly improve memory management and program performance in C++.

Summary & Key Takeaways

  • The "new" keyword is used to allocate memory on the heap in C++. It is important for managing memory and optimizing performance.

  • When using the "new" keyword, the necessary size of the allocation is determined based on the type of data being allocated.

  • The "new" keyword also calls the constructor of the allocated object. It is important to use the "delete" keyword to release the allocated memory.


Read in Other Languages (beta)

English

Share This Summary 📚

Summarize YouTube Videos and Get Video Transcripts with 1-Click

Download browser extensions on:

Try YouTube Summary with ChatGPT & Claude or YouTube Transcript Generator

Explore More Summaries from The Cherno 📚

Implicit Conversion and the Explicit Keyword in C++ thumbnail
Implicit Conversion and the Explicit Keyword in C++
The Cherno
How to DEBUG C++ in VISUAL STUDIO thumbnail
How to DEBUG C++ in VISUAL STUDIO
The Cherno
Welcome to OpenGL thumbnail
Welcome to OpenGL
The Cherno
What Does the Static Keyword Mean in C++ Classes? thumbnail
What Does the Static Keyword Mean in C++ Classes?
The Cherno
How the C++ Compiler Works thumbnail
How the C++ Compiler Works
The Cherno
Maths | Game Engine series thumbnail
Maths | Game Engine series
The Cherno

Summarize YouTube Videos and Get Video Transcripts with 1-Click

Download browser extensions on:

Try YouTube Summary with ChatGPT & Claude or YouTube Transcript Generator

Apps & Extensions

  • Chrome Extension
  • Safari Extension
  • Edge Add-ons
  • Firefox Add-ons
  • iOS App
  • Android App

Key Features

  • YouTube Video Summarizer
  • Web & PDF Summarizer
  • Web & PDF Highlighter
  • Chat with PDF
  • Ask AI Clone
  • Audio Transcriber
  • Glasp Reader
  • Kindle Highlight Export
  • Idea Hatch

Integrations

  • Obsidian Plugin
  • Notion Integration
  • Pocket Integration
  • Instapaper Integration
  • Medium Integration
  • Readwise Integration
  • Snipd Integration
  • Hypothesis Integration

More Features

  • APIs
  • MCP Connector
  • Blog & Post
  • Embed Links
  • Image Highlight
  • Personality Test
  • Quote Shots

Company

  • About us
  • Blog
  • Community
  • FAQs
  • Job Board
  • Newsletter
  • Pricing
Terms

•

Privacy

•

Guidelines

© 2026 Glasp Inc. All rights reserved.