|
Hi,
i have an application which is running as a windows service,
it's purpose is to poll different sensors in a specific interval. No problem so far and with .Net memory profiler i was able to reduce the memory consumption drastically (allocs are almost -> 0 byte/s).
But now the downside, my idea was to present the sensors data on a ASP.NET page. My first thought was using a webservice to connect the windows service with the IIS. However after reading a comparison between Remoting vs. Webservices i decided to do remoting with an IPC channel.
So far so good, i have implemented a very light Remoting object, in addition i use the IPC channel and binary formatters. But when my application was finally running i discoverd that each remoting call will take around 8 KB of memory! Furthermore it allocates at least 178! Instances of differnt .Net classes for each call.
Imagine that i have to update my data on the IIS every second and addionally i have more than one sensor. This would mean for example that 5 Sensors would cost 40 KB or more memory per second, surely the garbage collector will take care of it. But how long will it take until i get in serious memory trouble (like Memory Pressure by the framework)? I saw that the garbage collector is triggered every 10 s in the current setup (without remoting it's between 45 min - 2h)
There are a couple of Questions:
1. Is it possible to reduce the memory consumption of .Net remoting? (i saw no difference between singleton & singecall)
2. Is remoting not the right choice for my task?
BTW: The service is written in C++/CLI, the logic and pages on the IIS are in C#.
I would really appreciate any help! If needed i could also publish some code to resolve the issue.
ThanX Tobias
the remoting Interface (each call of GetIndex costs 8KB):
public interface class IRemotingLink
{
ArrayList^ GetSensorKeys (void);
array <unsigned char>^ GetIndex (String^ pSensorGuid, unsigned char pIndex);
array <array <unsigned char>^>^ GetIndices (String^ pSensorGuid);
bool SetIndex (String^ pSensorGuid, unsigned char pIndex, array <unsigned char>^ pIndexContent);
};
-- modified at 2:34 Friday 10th March, 2006
|
|
|
|
|
|
You really think people here will do your homework for you ?
If you want an answer, post specific questions and post what you already did.
|
|
|
|
|
thk for u all...i knw my fault...
i cant do tat like tis...sorry for disturd u all....
very apologize wit it....
|
|
|
|
|
|
|
yup, typo...
|
|
|
|
|
cusack! this is professor ulhas from the university. it told all of student to not cheat by gone to cpian and make others doubt the homework. but here i see u cheating. when i heard of this i wanted to slice my tongue open and a salted knife. that is how much ur cheatin hurts me. now u get black grade and fail.
Sincelery yours, Computer Information conSciences Professor and grader, Sharada Ulhas
|
|
|
|
|
thk for u all...i knw my fault...
i cant do tat like tis...sorry for disturd u all....
very apologize wit it....
im 2 care of my homework...
i scare will fail...i really no idea how 2 done..
whatever,i will take more time to revision all the things...
thk a lot
|
|
|
|
|
This CP forum is for people who can't continue their work, becase of the problem they can't solve. If you have a problem then ask if you want to other make your program, then don't even ask and start thinking.
|
|
|
|
|
i will not give up, i will convet this if its the last thing i do....
i am getting better though!!
void ManagedReadVoltage::ManagedDAQmxBaseCreateTask(const char taskName __gc[], TaskHandle *taskHandle)
{
DAQmxBaseCreateTask(taskName,taskHandle);
}
i am stuck here, i get this error...
'DAQmxBaseCreateTask' : cannot convert parameter 1 from 'const char __gc[]' to 'const char []'
the orginal code...
void UnmanagedReadVoltage::UnmanagedDAQmxBaseCreateTask(const char taskName[], TaskHandle *taskHandle)
{
DAQmxBaseCreateTask(taskName,taskHandle);
}
i have looked on google, but i can't get it working..anyway i need some sleep
thanks
|
|
|
|
|
|
Here is the code:
<br />
#include "class2.h"<br />
<br />
class A<br />
{<br />
public:<br />
A(void) {}<br />
~A(void) { if ( _cls2) delete _cls2; }<br />
public:<br />
void Create(void) { _cls2 = new B(this); }
void Display(void) { printf("from A"); }<br />
private:<br />
B * _cls2;<br />
};<br />
<br />
#include "class1.h"<br />
<br />
class B<br />
{<br />
public:<br />
B(A * ptr) : _cls1(ptr) {}<br />
~B(void) {}<br />
public:<br />
void Do(void) { _cls1->Display(); }<br />
private:<br />
A * _cls1;<br />
};<br />
But I got error on compiling
How to solve it?
|
|
|
|
|
in one of the files, before the definition of the class, declare the other one.
for example :
class A;
class B {
};
|
|
|
|
|
You mean combine two .h files into one .h file?
Is it possible to solve it in two .h files?
THX for your quick reply
|
|
|
|
|
shaohao wrote: You mean combine two .h files into one .h file?
no
file A.h
#include "B.h"
class A {
};
file B.h
#include "A.h"
class A;
class B {
};
|
|
|
|
|
But I think it should be:
<br />
file A.h<br />
<br />
#include "B.h"<br />
<br />
class A {<br />
};<br />
<br />
file B.h<br />
<br />
class A;<br />
<br />
class B {<br />
};<br />
Any idea?
Is it right?
-- modified at 9:11 Friday 10th March, 2006
|
|
|
|
|
Yes - this is correct. It compiles without a problem.
gmileka
|
|
|
|
|
i thought it would be better to make a new tread for this one.
i am trying to get this code to work, but i don't know what i'm doing wrong..
i know this much....
i have a class library(.net) called fooManaged and its automatical created fooManaged.h. and i created UnManaged.h
in the UnManaged.h file i have this code.....
#include iostream
#include vcclr.h
using namespace std;
class Foo
{
public:
Foo();
~Foo();
void DoSomeFoo();
};
// constructor
Foo::Foo()
{
cout<<"Constructor called!"<<endl;
}
destructor
foo::~foo()=""
{
cout<<"destructor="" called"<<endl;
}
="" some="" method
void="" foo::dosomefoo(void)
{
cout<<"do="" something="" funny!"<<endl;
cout<<"burrrp!"<<endl;
}
in="" foomanaged.h="" i="" have="" this="" code....
="" foomanaged.h
#pragma="" once
using="" namespace="" system;
namespace="" foomanaged
{
public="" __gc="" class="" mfoo
{=""
private:
foo="" *="" _foo;
public:
mfoo();
~mfoo();
void="" manageddosomefoo();
};
="" constructor
mfoo::mfoo()=""
{
_foo="new" foo();
}
="" destructor
mfoo::~mfoo()
{
delete="" _foo;
}
="" mfoo::manageddosomefoo()=""
{
_foo-="">DoSomeFoo();
}
}
the fooManaged.cpp file just has...
#include "stdafx.h"
#include "Unmanagedfoo.h"
#include "fooManaged.h"
#using mscorlib.dll
it all compiles...but there is a big linking error!!
Compiling...
fooManaged.cpp
Linking...
LINK : error LNK2020: unresolved token (0A000005) _CxxThrowException
LINK : error LNK2020: unresolved token (0A000019) free
LINK : error LNK2020: unresolved token (0A00001A) strlen
LINK : error LNK2020: unresolved token (0A00001B) memmove
LINK : error LNK2020: unresolved token (0A00001C) memcpy
LINK : error LNK2020: unresolved token (0A00001D) delete
LINK : fatal error LNK1120: 6 unresolved externals
i must be doing something wrong, some help with this will be very wecome
thanks
|
|
|
|
|
|
i dont know how to do that, so i guessed at added msvcrt.lib to the command line in addional options in the linker properties, but i get even more errors!
|
|
|
|
|
Project's Property Pages dialog box -> Linker->Input. Add msvcrt.lib to the Additional Dependencies.
My programming blahblahblah blog. If you ever find anything useful here, please let me know to remove it.
|
|
|
|
|
thanks man, i've done that but i am stil getting errors when linking, just two though...
Linking...
libcpmtd.lib(xdebug.obj) : error LNK2019: unresolved external symbol __malloc_dbg referenced in function "void * __cdecl operator new(unsigned int,struct std::_DebugHeapTag_t const &,char *,int)" (??2@YAPAXIABU_DebugHeapTag_t@std@@PADH@Z)
libcpmtd.lib(_tolower.obj) : error LNK2001: unresolved external symbol __malloc_dbg
libcpmtd.lib(xdebug.obj) : error LNK2019: unresolved external symbol __free_dbg referenced in function "void __cdecl operator delete(void *,struct std::_DebugHeapTag_t const &,char *,int)" (??3@YAXPAXABU_DebugHeapTag_t@std@@PADH@Z)
C:\Documents and Settings\Major Pigeon\My Documents\Visual Studio Projects\fooManaged\Debug\fooManaged.dll : fatal error LNK1120: 2 unresolved externals
|
|
|
|
|
Ok so I've got my C++/CLI solution, which now includes some old native C files (not C++ files). I don't want these C files to be compiled to managed; I just want to be able to call them from my managed ref classes in my C++/CLI solution. How can I do that? The compiler complains it won't compile .c files with the /clr syntax.
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Lent Revisited
The apostle Paul, modernly speaking: Epistles of Paul
Judah Himango
|
|
|
|
|
Judah Himango wrote: The compiler complains it won't compile .c files with the /clr syntax.
Yeah, one of "advances" that came with VS2005.
Anyway, try to simply rename the c files to cpp and compile. You may get some compiler errors, but they should not be hard to fix.
My programming blahblahblah blog. If you ever find anything useful here, please let me know to remove it.
|
|
|
|