LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Memory Usage

Why application takes more memory at the start up and gradually comes down...
 
Thanks and Regards
Rakesh
0 Kudos
Message 1 of 12
(4,260 Views)
Hello Rakesh,
 
The behavior you are seeing could be a result of various factors such as the structure of your application.  You could be allocating memory at the beginning of your application, then deallocating it, so you see a decrease in memory usage.  It would be helpful if you could include a small example program demonstrating the behavior you are seeing in order for us to give you a definitive answer.
 
Thanks
Wendy L
LabWindows/CVI Developer Newsletter
0 Kudos
Message 2 of 12
(4,238 Views)
Hello Wendy
 
Thanks but in my application i am allocating memory statically and there is no call of calloc or malloc. I am also attaching the source code of my application.
When i run this application it show around 11 MB of memory usage which gradually comes down to around 3 MB within 3 to 4 hrs. A similar behavior i observed in some other application developed using CVI.
 
Regards
Rakesh
0 Kudos
Message 3 of 12
(4,226 Views)
Hello Rakesh,
 
I noticed that you doing database logging and you're using other instrument drivers.  So in an attempt to isolate the behavior to a particular codeset, it might be better to identify what is the same between the two applications with which you are seeing this issue.  So you mentioned that you are seeing the same behavior with another CVI-built application.  What is the same between these two applications?  Are they both doing database logging?  Are they both using the same database driver?  Identifying the differences and similarities between these two applications will really help narrow down the cause of this behavior.
 
Thanks.
Wendy L
LabWindows/CVI Developer Newsletter
0 Kudos
Message 4 of 12
(4,208 Views)
Hello Wendy
 
Sorry  for the delayed response. About the other application(PDF1.exe) which give me the same behavior has only similarity as both listen to the same data socket ports. But there is no database operation as you can find in my application (datalog.exe).  PDF1.exe has dynamic memory allocation (but almost fixed). PDF1.exe shows initially around 11.5 MB of memory usage and then later come down 3 to 4 MB with in 2-3 hours and continued and maintain the same memory band (Between 3 to 4 MB). I expect no memory leakage from PDF1.exe.
Please suggest me which is causing this behavior
 
Thanks and Regards
Rakesh
0 Kudos
Message 5 of 12
(4,188 Views)
Hello Rakesh,
 
I'm not able to run your application because I don't have the same database sources set up, but I noticed that you have the nireport instrument in your project.  Are you using that anywhere in your code?  If not, I would remove it from your workspace.  So from your description of the behavior, it would be just the opposite of a memory leak.  CVI is allocating memory up front then slowly releasing memory as the application proceeds.  Does the memory usage ramp up at any point in time and then decrease, or does the usage start off high and only decrease as time progresses?  Also, is there anything in particular that occurs 3-4 hours in the execution of your application, because it seems interesting that two different applications start off using virtually the same amount of memory and then gradually decreases over the course of 3-4 hours and end up using the same amount of memory at that time.  Are these two applications based off the same code set (as in, are they similar applications with a few changes)?
 
Thanks.
Wendy L
LabWindows/CVI Developer Newsletter
0 Kudos
Message 6 of 12
(4,171 Views)

Hello Wendy

Thanks! I initially planned to you Nireports. But now since it is not necessary i removed Nireports from my source code but there is no change in behavior. In my application i am not allocating the memory dynamically instead i am allocating statically. But in other application too only at the start up there is major block of memory allocation which get released only when it exit. There is no ramp up in memory usage at any point. And behavior of application should be remain same through out its life. My application gets the latest data from datasocket (Event based) but log into database at every minute. I have static arrays to store these data. I am attaching the database script for your reference. Please let me know for any information needed from me.

Thanks and Regards

Rakesh

 

0 Kudos
Message 7 of 12
(4,167 Views)

Hello Rakesh,

Is it possible for you to reproduce this behavior in a shorter period of time?  If so, I would put breakpoints in your code so you can track down exactly where all the memory is being allocated and which function is freeing it.

Thanks.

Message Edited by Wendy L on 08-30-2005 10:48 PM

Wendy L
LabWindows/CVI Developer Newsletter
0 Kudos
Message 8 of 12
(4,147 Views)
Hello Wendy
 
I am not able to follow up properly. Application still produce the same behavior as i mentioned.  Do you mean to reproduce in some different manner. You can send me code with break points where you want. I will observe the behavior and let you know.
 
Thanks for your regular replies.
 
Regards
Rakesh
0 Kudos
Message 9 of 12
(4,143 Views)

Hello Rakesh,

You mentioned that you see a dramatic decrease in memory usage when your application exits.  So you should have a stop callback.  I would suggest putting a breakpoint in that callback and monitoring which function releases your memory.  Also, i would put breakpoints at the beginning your application to see exactlly which functions are causing your application to use a large amount of memory at start up.

Thanks.

Wendy L
LabWindows/CVI Developer Newsletter
0 Kudos
Message 10 of 12
(4,133 Views)