Comments (8)
I should mention, that the memory leak happens in the client process.
I also found a hint to the problem. If you change the type of the Outlet to
float32, everything works as expected, so the problem seems to be related to
the string type.
Original comment by [email protected]
on 15 Aug 2014 at 2:07
from lsl_archived.
Same Problem here using the c# wrapper!
Original comment by [email protected]
on 17 Mar 2015 at 12:16
from lsl_archived.
The reason seems to be obvious -- lsl_pull_chunk_str() calls malloc() for each string it returns. There's no easy way to call free() from C# (nor from Python, I assume), so an additional C function, e.g. "lsl_chunk_str_free(char **data_buffer, double *timestamp_buffer, unsigned long data_buffer_elements, unsigned long data_buffer_row_elements)", would have to be written to call free() in a 2-level loop.
from lsl_archived.
It would seem that the C++ interface will have the same problem if an exception is thrown -- lsl::stream_inlet::pull_chunk_multiplexed() and lsl::stream_inlet::pull_sample() both call check_error() (which can throw an exception) before they get a chance to call lsl_destroy_string().
from lsl_archived.
Hi ulatekh,
good point re string freeing. As you noticed, liblsl actually offers a
function just for that purpose, lsl_destroy_string, it's just that the
Python interface isn't calling it. We'll address that at the next
opportunity.
Now regarding the C++ interface, you're right, though these two functions
basically don't throw exceptions in practice unless you disable the
recovery option when reading from a stream (in which case you can get one
when the sender program disconnects); however, you basically leak one
string for each disconnect, and I suppose that would have to happen a few
hundred million times in a row until you run out of memory! ;)
Best,
Christian
On Thu, Aug 13, 2015 at 1:42 PM, ulatekh [email protected] wrote:
It would seem that the C++ interface will have the same problem if an
exception is thrown -- lsl::stream_inlet::pull_chunk_multiplexed() and
lsl::stream_inlet::pull_sample() both call check_error() (which can throw
an exception) before they get a chance to call lsl_destroy_string().—
Reply to this email directly or view it on GitHub
sccn/labstreaminglayer#20 (comment)
.
from lsl_archived.
@chkothe: I've written a fix for the C# interop layer, but haven't been able to test it yet -- I'm still trying to get running with LSL in general. I also fixed some potential memory leaks in lsl_inlet_c.cpp, but again, can't test them yet. I can commit them to a branch of my LSL fork if you want to see them now.
from lsl_archived.
Hey ulatekh,
thanks, fixes like that are most welcome! Take your time, and feel free to
open a pull request on GitHub, that would be most convenient for David and
myself! (but patch is also fine)
Best,
Christian
On Thu, Aug 13, 2015 at 5:12 PM, ulatekh [email protected] wrote:
@chkothe https://github.com/chkothe: I've written a fix for the C#
interop layer, but haven't been able to test it yet -- I'm still trying to
get running with LSL in general. I also fixed some potential memory leaks
in lsl_inlet_c.cpp, but again, can't test them yet. I can commit them to a
branch of my LSL fork if you want to see them now.—
Reply to this email directly or view it on GitHub
sccn/labstreaminglayer#20 (comment)
.
from lsl_archived.
sccn/labstreaminglayer#50 contains my fixes for the C# interop layer, as well as some fixes in the existing C/C++ code.
Someone in a position to test the python wrapper can use the C# changes as inspiration.
from lsl_archived.
Related Issues (20)
- How to change output dimension of inlet.pull_sample() HOT 5
- Default values for lsl_api.cfg are hard-coded and confusing HOT 1
- Which pylsl? HOT 3
- Cmake issue when build LabStreamingLayer application for Emotiv HOT 14
- Not reading serial data from Arduino
- LSL DLL on ARM64 Architecture HOT 4
- Can't Run LabRecorder App on Mac OS 10.13.4 HOT 1
- libjnidispatch.so? HOT 11
- Connection to smartphone HOT 1
- C++ 2015 professional and matlab 2015b HOT 1
- windows 10 LAN lsl fail HOT 7
- the trouble with __func__ HOT 9
- Firewall settings for LSL to work? HOT 2
- External native build issues while building LSL Android Studio examples HOT 4
- Errors when building BrainAmp App HOT 1
- Missing timeout parameter in C# binding for wait_for_consumers()
- BrainVisionRDA: compilation error (CMake on Windows) HOT 2
- pull_chunk starts and KEEPS returning empty after a short delay in stream AND stream is back HOT 1
- blocking call to pull_sample become unresponsive when no data available HOT 3
- How to load xdf multiple file ? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lsl_archived.