Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Problem serializing large datastructure

Problem serializing large datastructure

Scheduled Pinned Locked Moved C#
graphicsdata-structuresjsonperformancehelp
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Schokoolero
    wrote on last edited by
    #1

    I am using a datastructure that represents a triangle mesh. It contains a list of 3D-vertices, a list of triangles (indices of the vertices used for the triangle), a list of edges (also indices) and some additional data. Each triangle has a 3D-vertex attached to it (the normal vector), so does each vertex. The angles and the area are also stored with every triangle. And every vertex stores the principal curvatures and their directions (as 3D-vertices). Every vertex stores a list of adjacent triangles and a list of neighboring vertices (also as indices). All of that is not a problem for serialization. But I also need to store the distances from every vertex to every other vertex (to calculate the curvatures). I do this by storing the distance from one vertex to every vertex preceding it in the list of vertices with that vertex, so there is no redundance. (I tried a single array for all the distances, but it was too much and I got an OutOfMemoryException.) My sample mesh contains 11703 vertices, 23402 triangles and 35103 edges, but the program should be capable of handling meshes a lot larger. I originally used doubles, as most of the "Math" methods return doubles. But I switched to float to save memory. Now the program uses about 500MB of my 2GB of memory. The distances are still too much for the serialization. (I tried storing just the distances using a StreamWriter and WriteLine and got a txt-file larger than 1GB, which is way too large.) Serialization always throws an OutOfMemoryException. (I used binary serialization and GZip-Compression.) Does anyone know a way of serializing such large datastructures?

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups