Skip to content

GH-49408: [C++][Parquet] Add protected non-virtual destructor to parquet::Page#49409

Open
HuaHuaY wants to merge 1 commit intoapache:mainfrom
HuaHuaY:fix_issue_49408
Open

GH-49408: [C++][Parquet] Add protected non-virtual destructor to parquet::Page#49409
HuaHuaY wants to merge 1 commit intoapache:mainfrom
HuaHuaY:fix_issue_49408

Conversation

@HuaHuaY
Copy link
Contributor

@HuaHuaY HuaHuaY commented Feb 27, 2026

Rationale for this change

Clarify the destructor implementation of parquet::Page to expose the design intent.

What changes are included in this PR?

Add protected non-virtual destructor to parquet::Page.

Are these changes tested?

Yes.

Are there any user-facing changes?

Yes. If someone used Page* or std::unique_ptr<Page> to release a subclass object before, it would get a memory leak. And now it gets a compile error.

Copilot AI review requested due to automatic review settings February 27, 2026 11:50
@HuaHuaY HuaHuaY requested a review from wgtmac as a code owner February 27, 2026 11:50
@github-actions
Copy link

⚠️ GitHub issue #49408 has been automatically assigned in GitHub to PR creator.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a protected non-virtual destructor to the parquet::Page base class to clarify design intent and improve type safety. The change prevents deletion of Page subclasses through raw Page* pointers, which would previously result in memory leaks or undefined behavior. The existing codebase uses std::shared_ptr for all Page object management, which remains safe with this change because the shared pointer stores the correct deleter for the actual derived class.

Changes:

  • Added protected non-virtual destructor to parquet::Page class

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants