pcbjam/wasm/shims/mallinfo_stub.c
Gergő Törcsvári 88aaba99c9
feat(libs): react load overlay + progress bar; mimalloc mallinfo stub; framed tests
- WasmTool/source.ts: LIB_LOADING_EVENT brackets the fat-load; full-cover
  overlay ('Loading <kind> libraries…') with a per-lib progress bar (done/total
  from listLibs), show-on-first / hide-after-last coalescing.
- mallinfo stub (wasm/shims/mallinfo_stub.c + build-kicad-target.sh): -sMALLOC=
  mimalloc doesn't export glibc mallinfo() that OpenCASCADE OSD_MemInfo (pcbnew
  3D) needs; zeroed no-op unblocks the pcbnew link.
- source/cdn-source tests: updated to the framed Uint8Array 'bodies' contract.
- bump kicad -> e8db3d3.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-01 09:56:32 +02:00

23 lines
952 B
C

/*
* mallinfo() stub for the mimalloc-allocator build.
*
* We link with -sMALLOC=mimalloc (per-thread heaps — needed so the parallel
* s-expr library parse doesn't serialize on dlmalloc's single global lock; see
* docs/features/libs/0013). Unlike emscripten's dlmalloc/emmalloc, mimalloc does
* NOT export the glibc memory-report API mallinfo()/mallinfo2(). OpenCASCADE's
* OSD_MemInfo.cxx (in libTKernel, linked only by pcbnew for 3D/STEP) references
* mallinfo(), so the pcbnew link fails with `undefined symbol: mallinfo` without
* this. (eeschema doesn't link OpenCASCADE, so it never needed it.)
*
* mallinfo() is used purely for optional memory reporting, so a zeroed result is
* harmless. Provided unconditionally (mirrors the nanosleep_yield / gl_ffp stub
* pattern); it's a no-op for apps that never reference it.
*/
#include <malloc.h>
struct mallinfo mallinfo( void )
{
struct mallinfo info = { 0 };
return info;
}