Consider this mock-up of a software stack designed with layered architecture in mind :
Every application layer is decoupled through API calls, but a memory handling library is used throughout. All layers need to copy, allocate or somehow affect memory.
Is this bad use of the layered architecture pattern, or is it one of its pitfall ? On one hand, trying to force the pattern upon the library calls, perhaps by adding memory handling wrappers to every application layers, would create a lot of boilerplate code. On the other hand, letting layers, through library calls, create arbitrary entry points into different layers seems to contradict the very rationale behind layered architecture.