Использование памяти WPF

Исправлено путем установки одинакового значения для Access-Control-Allow-Headers и Access-Control-Request-Headers на Camel и ReactJ.

ReactJs

headers: {
'Content-Type': 'application/json',
'Access-Control-Allow-Origin': '*',
'Access-Control-Request-Headers': 'access-control-allow-methods,access-control-allow-origin,authorization,content-type',
'Access-Control-Allow-Headers': 'access-control-allow-methods,access-control-allow-origin,authorization,content-type',
'Access-Control-Allow-Methods': 'GET, DELETE, POST, OPTIONS, PUT',
}

Верблюд:

.setHeader("Access-Control-Allow-Origin", constant("*"))        
.setHeader("Access-Control-Allow-Headers", constant("access-control-allow-methods,access-control-allow-origin,authorization,content-type"))        
.setHeader("Access-Control-Allow-Methods", constant("GET, DELETE, POST, OPTIONS, PUT"))
9
задан Gus Cavalcanti 12 May 2009 в 18:23
поделиться

6 ответов

Рискуя быть бойким, у вас утечка памяти. Почему бы не попробовать такой инструмент, как ANTS *, чтобы его отследить. У них есть бесплатная пробная версия, я никогда ею не пользовался, но она имеет хорошую репутацию.

* Доступны другие инструменты профилирования.

Если вы не хотите разбираться в другом инструменте, вы можете попробовать что-нибудь например, увеличивая статический член каждый раз при создании класса и уменьшая его каждый раз при удалении экземпляра. Это поможет вам отследить экземпляры, которые не были уничтожены должным образом.

6
ответ дан 4 December 2019 в 15:26
поделиться

LOL 200MB startup and 1GB run.. More common penalty on x64 (and you will need it for bloat) is a penalty of around 64MB for startup and another 120MB for semi-advanced functionality, which is still huge and of course GC will keep adding more.

That's gotta kill the CPU and all the periphery around it in no time. Now imagine everything runs on that, all apps, and the entire OS and stack (as VS2010 surely will attempt some move in that direction).

I'd say: welcome to the modern way of bloatware mania and its ease of accessibility. No matter what you do you'll spend more time finding workarounds then following some 'universal' framework to quick and cool and well-styled and customisable apps. Sure WPF is good on paper but a waste of resource in any practical use (tons of resources and a steep learning curve).

And they said it was and still is the future (same for JDK apps which are oh-so-widespread).

Simply N.U.T.S + the most excellent example that it is not about speed (as CLR defenders will jump in with trivial examples) of managed code. It is about huge scalability impairement and machine wipeout as with every single GC and object-root environment out there.

Vote down coming.. go on disciples, you know you want to.

(and write to Obama against CO2 reduction that will not happen; perhaps multiply by 1003120x if that bandwagon keeps going the way it has. Even a Cray Jaguar wouldn't run that kind of operating environment any time in the next 20 years ).

3
ответ дан 4 December 2019 в 15:26
поделиться

Вы можете использовать

WPF Performance Suite

Оптимизация производительности приложений WPF

Меня преследует аналогичная проблема .. (что-то вроде)

При запуске приложения я запрашиваю базу данных и получаю всех сотрудников и связанную информацию, которая будет отображаться в ListBox. Это все время хранится в памяти.

Может быть, вы могли бы изменить свой код, чтобы следовать WPF: виртуализация данных

3
ответ дан 4 December 2019 в 15:26
поделиться

It really seems to be memory leaking. Probably, some of the UI elements in the DataTemplate keep references to other objects that should stay alive even when the UI element is destroyed.

There could be some memory leaks with Image control. Try removing it from the template and see the result. Also, are you subscribing to any events in controls' Loaded events or something like that?

Just some guesses though... As people already said here you might really want to look at your app with performance and memory profilers.

1
ответ дан 4 December 2019 в 15:26
поделиться

Я заметил, что в WPF и .NET 3.5 SP1 есть некоторые проблемы с памятью в, казалось бы, безобидных ситуациях.

Я нашел несколько ресурсов, но не уверен, что они будут вам полезны:

http://blog.ramondeklein.nl/?p=58

В этом сообщении в блоге описывается ситуация, когда

  1. стиль определяется в ResourceDictionary приложения.
  2. ] В стиле используется шаблон элемента управления, в котором используются мультимедийные эффекты (т. Е. DropShadowEffect).
  3. На медиа-эффект следует ссылаться с помощью StaticResource

Вкратце, я думаю, что ваше решение будет заключаться в том, чтобы гарантировать, что любые медиа-эффекты (drophadow и т. Д.) Используют статические ресурсы.

0
ответ дан 4 December 2019 в 15:26
поделиться

One thing that helped me a lot was to use a class wrapping the Stream class. This is explained in detail here and sure enough I saved a lot of memory by using this method. WPF really keeps the reference to the underlying byte[] and stream for each picture.

0
ответ дан 4 December 2019 в 15:26
поделиться
Другие вопросы по тегам:

Похожие вопросы: