Skip to content

Memory Optimization for ItemsRepeater with 600,000 Items in AvaloniaUI 11.1.0 beta 1 #15600

Closed Answered by thevortexcloud
kokaKOLA-NEW asked this question in Q&A
Discussion options

You must be logged in to vote

You seem to be using Marshal and native pointers. Without seeing the rest of your code it's possible you may have a memory leak, if you do not ever free the native memory allocated to the pointers region.

It also looks like you are eager loading your data, as such based on some quick math and some assumptions:

  • Assuming each file name is ~20 characters, that would be: 20 bytes
  • Assuming each path is 260 characters, that would be 260 bytes
  • Assuming a DateTime takes up ~100 bytes (I have no idea what the actual size of it is so that's a complete guess)
  • A long takes up 64 bits. or 8 bytes

Which means you are looking at roughly 388 bytes per object. Multiply that by 600000 you get 232 megabyt…

Replies: 2 comments 9 replies

Comment options

You must be logged in to vote
2 replies
@kokaKOLA-NEW
Comment options

@thevortexcloud
Comment options

Comment options

You must be logged in to vote
7 replies
@timunie
Comment options

@kokaKOLA-NEW
Comment options

@kokaKOLA-NEW
Comment options

@thevortexcloud
Comment options

Answer selected by kokaKOLA-NEW
@thevortexcloud
Comment options

@kokaKOLA-NEW
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants