Skip to content

[Bug]: Remove alloc usage from patina sdk #1403

Closed

Description

@kuqin12

Is there an existing issue for this?

  • I have searched existing issues

Current Behavior

Current Patina SDK pulls alloc for a few sub-modules unnecessarily.

Specifically,

  1. For pi/hob.rs, there is unconditional consumption of Vec and Box, which requires global allocator. This should not be the case for a PI standard hob crate.
  2. For pi/fw_fs.rs, the code uses Vec to represent the block map entries.

In addition, some sub-modules are including alloc through extern crate alloc; unconditionally. This will cause the top-level switch, the "alloc" feature flag, not functional without sprinkling the preprocessors.

The suggestion is that extern crate alloc; should only be used from the crate root, which allows the feature flag to guard the module dependencies from a central location.

Expected Behavior

At least for pi/hob, we should be able to use the normal functionalities and definitions.

Or for fw_fs and its consumers, we should guard out the sub-module from the top level.

In addition, we should remove all the extern crate alloc; in the nine realms.

Steps To Reproduce

Inspect the code repo.

Build Environment

- OS(s): Windows
- Tool Chain(s): nightly-2026-02-13
- Targets Impacted: X64

Version Information

Patina-v20.0.1

Urgency

Medium

Are you going to fix this?

I will fix it

Do you need maintainer feedback?

No maintainer feedback needed

Anything else?

No response

Metadata

Metadata

Assignees

Labels

state:needs-triageNeeds to triaged to determine next stepstype:bugSomething isn't workingurgency:mediumImportant with a moderate impact

Type

Projects

  • Status
    Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions