wxMaxima
Loading...
Searching...
No Matches
Data Structures | Macros | Functions
test_CellSize.cpp File Reference

Keeps the per-cell memory footprint from creeping back up (GH #804). More...

#include <wx/app.h>
#include <wx/bitmap.h>
#include <wx/dcmemory.h>
#include <wx/log.h>
#include "Configuration.h"
#include "MathParser.h"
#include "cells/Cell.h"
#include "cells/TextCell.h"
#include <cstdio>
#include <catch2/catch.hpp>
Include dependency graph for test_CellSize.cpp:

Data Structures

class  TestApp
 

Functions

 SCENARIO ("Cells stay small (GH #804)")
 
 SCENARIO ("Ordinary maths cells allocate no side data")
 
 SCENARIO ("A UUID and unknown attributes survive parsing and ToXML()")
 
 SCENARIO ("Clearing the UUID of a cell that has none doesn't allocate")
 
 wxDECLARE_APP (TestApp)
 
int main (int argc, char **argv)
 

Detailed Description

Keeps the per-cell memory footprint from creeping back up (GH #804).

A large result (a polynomial with a million terms) becomes several million cells, so every byte in Cell counts several megabytes. A cell's UUID and its unknown XML attributes used to be a wxString and a std::map in every cell (96 bytes on 64-bit Linux), although only GroupCells normally get a UUID; they now live in side data that is only allocated when used. This test checks both halves: that an ordinary maths cell allocates none of it, and that the data still survives the trip through MathParser and ToXML() for the cells that do carry it.